我已经用https设置了一个gem repo。我们有内部签名证书,我有歌手/信托证书。
但是我不确定在哪里安装这些pem文件,因此在尝试执行gem安装时得到ssl错误。
我们使用的是CHEF,因此使用在chef客户端安装中安装的ruby。
我已经通过网络搜索,唯一的aswer人有一个变通办法,这是从https更改为http,但我希望gem repo设置与HTTPS (端口443)
下面是我得到的错误
[root@opslx0005 ~]# /opt/chef/embedded/bin/gem install lvm
ERROR: Could not find a valid gem 'lvm' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://myself.mydomain.com/artifactory/simple/infra-automation/gem-repo/latest_specs.4.8.gz)
尝试使用Ruby remote_fetcher进行测试
/opt/chef/embedded/bin/ruby -rrubygems/remote_fetcher -e 'p Gem::RemoteFetcher.new.fetch_http(URI.parse("https://myself.mydomain.com/artifactory/simple/infra-automation/gem-repo/latest_specs.4.8.gz")).bytesize'
更新:
这是我在网上找到的,这是我的默认pem文件,我在这里更新了证书,但错误仍然没有出现。
/opt/chef/embedded/bin/ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE'
/opt/chef/embedded/ssl/cert.pem
发布于 2014-11-06 05:57:33
最简单的解决方案可能是将SSL_CERT_FILE
环境变量设置为CA证书文件。这应该会被Ruby的OpenSSL层自动拾取。
发布于 2014-12-28 00:01:05
从这里:SSL Error During Gem Installation (on MinGW64-MSys2)
尝试下载http://curl.haxx.se/ca/cacert.pem证书。然后,将一个特殊的环境变量指向它,如下所示:export SSL_CERT_FILE=~/cacert.pem
之后,发出一个更新命令:gem update --system
问题应该在那之后就解决了。重新启动控制台并继续您的工作。
发布于 2015-04-24 01:20:06
我也有同样的问题,我认为这是企业代理,但我只需要更新rubygems。您可能需要从https://github.com/rubygems/rubygems/releases/下载最新版本
将其复制到ruby gems文件夹,然后在cmd上
C:\>gem install --local C:\rubygems-update-1.8.30.gem
C:\>update_rubygems --no-ri --no-rdoc
希望这能有所帮助!
https://stackoverflow.com/questions/26766401
复制相似问题