Rails + PostgreSQL SSL解密失败 [英] Rails + PostgreSQL SSL decryption failure
问题描述
我的生产服务器上正在运行一个应用程序,该应用程序使用 pg
gem与Postgres数据库进行通讯。 Postgres在默认端口上运行,并且位于防火墙后面-因此只能通过 localhost
进行访问。我尚未配置Postgres做与SSL相关的任何事情。
I have an app running on my production server that uses the pg
gem for talking to a Postgres database. Postgres is running on the default port, and is behind a firewall - so it's not accessible from anything but localhost
. I haven't configured Postgres to do anything SSL-related.
我正在通过SSL访问Rails应用程序,并且该证书已为另一个域签名,因此第一个每次您遇到它时,都会出现证书错误...但这是唯一与SSL相关的怪异事物。
I'm accessing the Rails app via SSL, and the certificate is signed for another domain, so the first time you hit it, a certificate error is presented...but that's the only thing SSL-related that's weird.
但是,我在我的位置间歇性地看到了这一点。 Rails日志(伴随浏览器发生错误500):
And yet, I'm seeing this intermittently in my Rails logs (accompanied by a 500 error in the browser when it happens):
Started GET "/admin/pages" for <xxx.xxx.xxx.xxx> at 2012-02-02 01:52:03 -0500
Processing by PagesController#index as HTML
Completed 500 Internal Server Error in 4ms
ActiveRecord::StatementInvalid (PGError: SSL error: decryption failed or bad
record mac
: SELECT "pages".* FROM "pages" ):
app/controllers/pages_controller.rb:36:in `index'
到底是什么?
推荐答案
如果数据库仅在本地主机上运行,请关闭SSL:对本地连接进行加密实际上不是很有用。在postgresql.conf中设置 ssl = false
(并重新启动数据库服务器),或者告诉您的客户端在连接时不要使用SSL。某些安装会将PostgreSQL配置为默认使用SSL。
If the database is running on localhost only, turn SSL off: it's not really useful to encrypt a local connection. Either set ssl=false
in postgresql.conf (and restart the db server) or tell your client not to use SSL while connecting. Some installations configure PostgreSQL to use SSL by default.
这篇关于Rails + PostgreSQL SSL解密失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!