在Rails应用程序中为PostgreSQL提供SSL证书

PJ *_*ron 8 postgresql ruby-on-rails amazon-web-services amazon-elastic-beanstalk

我使用Amazon RDS PostgreSQL实例在Elastic Beanstalk上有一个Rails应用程序.

我想pg使用SSL连接到这个数据库.

http://docs.aws.amazon.com/AmazonRDS/ [...]之后,我保存了rds-combined-ca-bundle.pem,/config/ca/rds.pemdatabase.yml看起来像这样:

production:
  adapter: postgresql
  database: <%= ENV['DB_NAME'] %>
  username: <%= ENV['DB_USERNAME'] %>
  password: <%= ENV['DB_PASSWORD'] %>
  host: <%= ENV['DB_ADDRESS'] %>
  port: <%= ENV['DB_PORT'] %>
  sslmode: 'require'
  sslrootcert: 'config/ca/rds.pem'
Run Code Online (Sandbox Code Playgroud)

但我不知道它是否真的使用SSL:我可以改变sslrootcert任何路径,我的应用程序仍在运行.我错过了什么?

PJ *_*ron 11

在您的database.yml使用sslmode: 'verify-full'sslmode: 'require',您必须使用而不是为了验证SSL证书中端点的实例端点.这样就可以使用证书了.