Rails上的PostgreSQL 3.2不尊重sslmode

时间:2015-02-26 21:40:24

标签: ruby-on-rails postgresql ssl amazon-web-services

我有一个使用Amazon RDS PostgreSQL数据库的Rails 3.2应用程序。我希望应用程序通过SSL连接到数据库。我的database.yml看起来像这样:

development:
  adapter: postgresql
  encoding: utf8
  database: xxx
  host: xxx.rds.amazonaws.com
  port: 1234
  sslmode: verify-full
  sslrootcert: <%= Rails.root %>/config/rds-combined-ca-bundle.pem
  username: xxx
  password: xxx

sslrootcert是从http://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem下载的公钥(参见http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.SSL

我遇到的问题是sslmode verify-full似乎不起作用。我可以将sslrootcert更改为/blah.pem,我的数据库仍然连接和我的Rails应用程序功能。我错过了什么?

1 个答案:

答案 0 :(得分:0)

我不确定,也没有测试过,但是......

这实际上是底层libpq库的一个功能,所有Rails,ActiveRecord和pg gem本身(AFAIK)都只是通过这些设置。因此,您可以通过升级libpq来获得您所追求的行为。看起来它是在8.4版本中引入的

相关问题