Enable SSL Connections

Configure SSL/TLS for secure database connections.

Prerequisites

  • CQL installed and configured

  • Database server with SSL enabled

  • SSL certificates (if using certificate verification)

PostgreSQL SSL

Basic SSL

Enable SSL in your connection URL:

MyDB = CQL::Schema.define(
  :my_db,
  adapter: CQL::Adapter::Postgres,
  uri: "postgres://user:pass@host/db?sslmode=require"
) do
end

SSL Modes

Mode
Description

disable

No SSL

allow

Try non-SSL first, then SSL

prefer

Try SSL first, then non-SSL

require

SSL required, no certificate verification

verify-ca

SSL required, verify CA

verify-full

SSL required, verify CA and hostname

With Certificate Verification

MySQL SSL

Environment Variables

Store certificates securely:

Verify SSL Connection

Test that SSL is working:

Cloud Database SSL

AWS RDS

Heroku

Heroku manages SSL automatically:

Troubleshooting

Certificate verification failed:

  • Check certificate paths are correct

  • Verify CA certificate matches server

  • Check certificate expiration

Connection refused:

  • Verify server has SSL enabled

  • Check firewall allows SSL port

  • Try sslmode=require first

See Also

Last updated

Was this helpful?