Ruby Enterprise Edition + OpenSSL - > “证书验证失败”

时间:2011-05-20 10:55:36

标签: ruby ssl openssl ruby-enterprise-edition

我有点噩梦试图让REE与SSL很好地合作。

每当我连接到SSL网站时:

require 'open-uri'
open 'https://www.google.com'

我收到以下错误:

/Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:586:in `connect'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:553:in `do_start'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:542:in `start'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:242:in `open_http'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:162:in `catch'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:518:in `open'
from /Users/jon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/open-uri.rb:30:in `open'

它在Ruby 1.9.2或常规1.8.7下工作正常。我尝试重新打包OpenSSL并安装ree来链接,如上所述on the RVM OpenSSL page,但它没有效果。我使用的是OS X 10.6.7,但我在安装OpenSolaris REE时遇到了同样的问题。

任何建议都会受到大力赞赏。

1 个答案:

答案 0 :(得分:3)

听起来它没有正确地获取可信CA证书的位置 - REE必须具有不同的已编译默认位置,这对您的系统来说是不正确的。


后人:

通过下载http://curl.haxx.se/ca/cacert.pem并将其复制到/opt/local/etc/openssl/cert.pem来解决OP的问题。