在 ruby​​-1.9.3 上从 net-https 获取 OpenSSL::SSL::SSLError (Mac OSX 10.6)

发布于 2025-01-05 21:54:45 字数 774 浏览 1 评论 0原文

我见过很多人遇到这个错误,但似乎没有解决方案可以为我解决这个问题:

ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

似乎有很多解决方案建议移动证书文件。我已经安装并卸载了 macports、homebrew 等作品。我已经为 github 设置了正确的密钥。当尝试进行 Rails 构建并调用 github 上的文件模板时,会发生此错误。

系统:Mac OSX 10.6 - 最近升级。 Ruby 1.9.3,也是最近的升级。轨道 3.2。我一直在谷歌上搜索,直到奶牛回家,并花了几个小时来解决这个问题,尽管似乎有几个这样的问题,但我仍然希望有人找到了解决方案,但尚未发布。我想我知道为什么会发生这种情况 - net/http 找不到证书,对吧?但我不知道如何解决它。预先感谢您的任何帮助。

编辑:更多信息。尝试在 ruby​​ 1.9.2(rvm 使用 1.9.2)中进行完全相同的构建,完成后不会抛出错误。

另一个编辑:我已经尝试了 rvm 页面上有关 openssl 软件包的所有内容,安装了该软件包并重新安装 ruby​​-1.9.3,并将配置标志指向该软件包的 openssl 。还是没有喜悦。

另一项编辑:似乎是 OpenURI 有问题 - 找不到一种方法让它知道证书位置:-(

I have seen a lot of people with this error and no solution seems to fix it for me:

ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

There seem to be a lot of solutions proposing shifting cert files around. I've installed and uninstalled macports, homebrew, the works. I have my keys set up right for github. The error is occurring when trying to do a rails build that calls on a template with files up on github.

System: Mac OSX 10.6 - recent upgrade. Ruby 1.9.3, also a recent upgrade. Rails 3.2. I have googled till the cows come home and spent hours on this problem and even though there seem to be several q's like this I am holding out hope someone found a solution and hasn't yet posted it. I think I know why it's happening - net/http is not finding the certs, right? But I cannot figure out how to fix it. Thanks in advance for any kind help.

Edit: Further info. Attempting the exact same build in ruby 1.9.2 (rvm use 1.9.2) completes without throwing the error.

Another edit: I have tried all the stuff on the rvm page about the openssl package, installing that and reinstalling ruby-1.9.3 with the config flag pointing openssl at that package. Still no joy.

One more edit: It seems to be OpenURI that's having the problem - cannot find a way to make it aware of the cert locations :-(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苦笑流年记忆 2025-01-12 21:54:45

我只是直接修改 MacOS 的 http.rb 源(L:669):

def use_ssl=(flag)
  flag = flag ? true : false
  if started? and @use_ssl != flag
    raise IOError, "use_ssl value changed, but session already started"
  end
  if flag && !@ca_file //added by riceball
    @ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' 
  end

必须先安装

 port install curl-ca-bundle

I just directly modify the http.rb source(L:669) for MacOS:

def use_ssl=(flag)
  flag = flag ? true : false
  if started? and @use_ssl != flag
    raise IOError, "use_ssl value changed, but session already started"
  end
  if flag && !@ca_file //added by riceball
    @ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' 
  end

must install first

 port install curl-ca-bundle
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文