我使用Authlogic-Connect第三方登录。在运行适当的迁移后,Twitter/谷歌/yahoo登录似乎工作正常,但facebook登录抛出异常:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

开发日志显示

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
  app/controllers/users_controller.rb:37:in `update'

请建议. .


当前回答

我在开发Ruby项目时遇到了同样的问题。我使用的是64bit的Windows 7。

我是这样解决的:

下载cacert。来自http://curl.haxx.se/ca/cacert.pem的Pem文件。 保存到C:/RubyCertificates/cacert.pem目录下 然后设置我的环境变量“SSL_CERT_FILE”为“C:\RubyCertificates\cacert.pem”

来源:https://gist.github.com/fnichol/867550

其他回答

我在尝试为Rails 3使用JQuery生成器时遇到了类似的问题

我是这样解决的:

Get the CURL Certificate Authority (CA) bundle. You can do this with: sudo port install curl-ca-bundle [if you are using MacPorts] or just pull it down directly wget http://curl.haxx.se/ca/cacert.pem Execute the ruby code that is trying to verify the SSL certification: SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem rails generate jquery:install. In your case, you want to either set this as an environment variable somewhere the server picks it up or add something like ENV['SSL_CERT_FILE'] = /path/to/your/new/cacert.pem in your environment.rb file.

您还可以将CA文件(我没有尝试过)安装到操作系统—这里有很长的说明—这应该以类似的方式工作,但我个人没有尝试过。

基本上,您遇到的问题是一些web服务正在响应针对OpenSSL无法验证的CA签名的证书。

OS x 10.8。x与Homebrew:

brew install curl-ca-bundle
brew list curl-ca-bundle
cp /usr/local/Cellar/curl-ca-bundle/1.87/share/ca-bundle.crt /usr/local/etc/openssl/cert.pem

你在OSX上得到这个错误的原因是rvm安装的ruby。

如果你在OSX上遇到这个问题,你可以在这篇博客文章中找到一个真正广泛的解释:

http://toadle.me/2015/04/16/fixing-failing-ssl-verification-with-rvm.html

简而言之,对于某些版本的Ruby, RVM会下载预编译的二进制文件,这会在错误的位置查找证书。通过强制RVM下载源代码并在您自己的机器上编译,可以确保证书位置的配置是正确的。

这样做的命令是:

rvm install 2.2.0 --disable-binary

如果您已经有问题的版本,您可以重新安装它:

rvm reinstall 2.2.0 --disable-binary

(显然,根据需要替换ruby版本)。

对我来说最直接的答案是

sudo apt-get install openssl ca-certificates

瞧! !

我在开发Ruby项目时遇到了同样的问题。我使用的是64bit的Windows 7。

我是这样解决的:

下载cacert。来自http://curl.haxx.se/ca/cacert.pem的Pem文件。 保存到C:/RubyCertificates/cacert.pem目录下 然后设置我的环境变量“SSL_CERT_FILE”为“C:\RubyCertificates\cacert.pem”

来源:https://gist.github.com/fnichol/867550