“证书验证失败";使用Ruby 1.9.3时发生OpenSSL错误 [英] "Certificate verify failed" OpenSSL error when using Ruby 1.9.3

查看:138
本文介绍了“证书验证失败";使用Ruby 1.9.3时发生OpenSSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS 10.6.8(使用rvm安装)上使用Ruby 1.9.3p0.当我尝试使用托管在GitHub上的应用程序模板创建新的Rails应用程序时(例如):

I'm using Ruby 1.9.3p0 on Mac OS 10.6.8 (installed using rvm). When I attempt to create a new Rails application using an application template hosted on GitHub, with this (for example):


$ rails new myapp -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-devise-template.rb -T -O

我收到此错误消息:

/Users/me/.rvm/rubies/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)

我了解Ruby语言解释器正在使用OpenSSL连接到GitHub以请求应用程序模板文件. GitHub要求所有连接都必须使用SSL建立.连接失败,因为OpenSSL无法验证服务器证书.

I understand the Ruby language interpreter is using OpenSSL to connect to GitHub to request the application template file. GitHub requires all connections to be made using SSL. The connection failed because OpenSSL was unable to verify the server certificate.

我能够通过下载证书文件解决此问题:

I was able to resolve the issue by downloading a certificates file:

$ cd /opt/local/etc/openssl
$ sudo curl -O http://curl.haxx.se/ca/cacert.pem
$ sudo mv cacert.pem cert.pem

我使用Ruby 1.9.2没问题.为什么我在Ruby 1.9.3中遇到证书验证失败"的问题?这是Ruby 1.9.3的错误吗?它特定于Mac OS 10.6.8吗?我的解决方案是解决此问题的正确方法吗?

I had no problem using Ruby 1.9.2. Why did I get the "certificate verify failed" problem for Ruby 1.9.3? Is this a Ruby 1.9.3 bug? Is it specific to Mac OS 10.6.8? Is my solution the right way to resolve this?

推荐答案

正确的答案涉及很多活动部分.取决于您的操作系统,Ruby版本,OpenSSL版本,Rubygems版本.经过研究,我最终写了一篇文章.我的文章解释了错误的原因,提供了进一步的诊断步骤,显示了几种解决方法,并提出了可能的解决方案.这会有所帮助:

There are lots of moving parts involved in the correct answer. Depends on your OS, Ruby version, OpenSSL version, Rubygems version. I ended up writing an article after researching it. My article explains the reasons for the error, offers steps for further diagnosis, shows several workarounds, and suggests possible solutions. This will be helpful:

OpenSSL错误和Rails –证书验证失败

在GitHub上也有指向相关提交和问题的链接.

There are also links to the relevant commits and issues on GitHub.

这篇关于“证书验证失败";使用Ruby 1.9.3时发生OpenSSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆