在安装Ruby 2.2.3之后捆绑SSL问题

时间:2015-12-16 10:17:28

标签: ruby-on-rails ruby ssl openssl rvm

Could not verify the SSL certificate for https://rubygems.<domain_removed>.com/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system
doesn't have the CA certificates needed for verification. For information about OpenSSL
certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and
change 'https' to 'http'.

我在尝试捆绑使用pre 2.0版本rails的现有rails应用程序时遇到了上述错误。当我在dir中ruby --version时,我得到: ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin14.1.0]

我昨晚使用RVM来安装ruby-2.2.3,似乎已经插入了我的证书。如何撤消或解决问题?

➜  homedev  rvm install ruby-2.2.3
Warning, new version of rvm available '1.26.11', you are using older version '1.26.10'.
You can disable this warning with:    echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable  auto-update  with:    echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.10/x86_64/ruby-2.2.3.tar.bz2
Checking requirements for osx.
Updating certificates in '/usr/local/etc/openssl/cert.pem'.
Requirements installation successful.
ruby-2.2.3 - #configure
ruby-2.2.3 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6338k  100 6338k    0     0   250k      0  0:00:25  0:00:25 --:--:--  334k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.3 - #validate archive
ruby-2.2.3 - #extract
ruby-2.2.3 - #validate binary
ruby-2.2.3 - #setup
ruby-2.2.3 - #gemset created /Users/stevebissett/.rvm/gems/ruby-2.2.3@global
ruby-2.2.3 - #importing gemset /Users/stevebissett/.rvm/gemsets/global.gems.......................-
ruby-2.2.3 - #generating global wrappers........
ruby-2.2.3 - #gemset created /Users/stevebissett/.rvm/gems/ruby-2.2.3
ruby-2.2.3 - #importing gemsetfile /Users/stevebissett/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.3 - #generating default wrappers........
Updating certificates in '/etc/openssl/cert.pem'.

2 个答案:

答案 0 :(得分:0)

我有类似的SSL验证问题。在我的情况下,我收到类似于

的错误
  

〜/ .rvm / rubies / ruby​​-2.2.3 / lib / ruby​​ / 2.2.0 / net / http.rb:923:在`connect&#39;:SSL_connect返回= 1 errno = 0 state = SSLv3 read服务器证书B:证书验证失败

默认的RVM二进制文件可能链接到OpenSSL路径,该路径不是系统中配置的路径。

我建议您删除Ruby 2.2.3并重新安装它,以便在您的计算机上编译二进制文件,以便链接正确的OpenSSL版本。

rvm remove 2.2.3
rvm install 2.2.3 --disable-binary

答案 1 :(得分:0)

我可以在执行以下操作后再次捆绑:

cd /usr/local/etc/openssl/
mv cert.pem cert.pem.old
wget http://curl.haxx.se/ca/cacert.pem
mv cacert.pem cert.pm

这将更改您的证书以使用此捆绑的CA根证书。

免责声明:我不确定是否有任何使用这些证书的警告。

可以在此处找到类似(但不相同)的问题: "Certificate verify failed" OpenSSL error when using Ruby 1.9.3