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



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

我希望pg使用SSL连接到这个数据库。

以下http://docs.aws.amazon.com/AmazonRDS/[…],我在/config/ca/rds.pem保存了rds-combined-ca-bundle.pem,我的database.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'

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

database.yml中,必须使用sslmode: 'verify-full'而不是sslmode: 'require',才能根据SSL证书中的端点验证实例端点。通过这种方式使用证书。

最新更新