Ruby 2.2.3 安装后捆绑 SSL 问题

Bundle SSL Issues after Ruby 2.2.3 installation

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'.

我在尝试捆绑使用 rails 2.0 之前版本的现有 rails 应用程序时遇到上述错误。当我在目录中执行 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'.

我遇到了类似的 SSL 验证问题。就我而言,我遇到了类似于

的错误

~/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

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

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

rvm remove 2.2.3
rvm install 2.2.3 --disable-binary

在执行以下操作后,我能够再次捆绑:

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