Certificate Verify Failed in "Gem Install Foundation"

certificate verify failed error when installing Ruby gems on Windows

I had this problem too. But using the older version is not the proper solution.

Here is the two solution help to fix this certificate error

1. Using the http instead of https will allow you to install the gem without that error

gem install bundler -r --source http://rubygems.org/

2. Update the certificate based on the solution provided in the below link

https://gist.github.com/luislavena/f064211759ee0f806c88

Could not find valid gem: certificate verify failed

Despite @the Tin Man's helpful answer, my problem was that I didn't have certificates set up in a place that OpenSSL could find them.

Following suggestions(s) in SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/:

An inferior workaround

One can work around this by changing the first line of Gemfile from

source 'https://rubygems.org'

to the non-https form:

source 'http://rubygems.org'

and then do the usual bundle install. Afterwards, you should restore the first line of your Gemfile to use the https form. This is generally considered a security risk.

What's more, you haven't really addressed the real problem that you lack valid certificates and you will run into trouble if your application calls uses OpenSSL (e.g. net-ssh).

A better fix

See SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/. For OS X users, we ask Ruby to tell us where it's looking for the certificates file, and then use security find-certificate to populate the certificates file:

$ cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
$ echo $cert_file
$ security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
$ security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"

After I did this, I was able to call bundle install without an error.

Could not find a valid gem 'rhc'. SSL_connect server certificate verify failed on Windows, Unable to connect OpenShift Server

The problem is that your Windows machine does not recognize the rubygems server certificate as a trusted certificate because Windows don't have its authority certificate present in its trusted certs store.

As a quick fix you'd need to remove the HTTPS version of the rubygems source URL (not HTTP as you did):

gem sources -r https://rubygems.org

This quick fix should make rubygems use the HTTP version which has no certificate checks involved.

But this should not be the definitive fix. Instead you should add the HTTPS source back (using the -a option) and install a proper CA certificate for the rubygems server cert into your windows trusted CA certs store.

There are quite a few pages that deal with this procedure on the net (google this), e.g. the post here has steps to download and install all CA certificates from the curl command, to your Windows machine, that fixes the problem permanently and without lowering security.

Unable to download data from https://rubygems.org/ because certificate verify failed

So my problem was that i needed to be running on ruby version 2.2.2. However that update (only for windows users) pulled a lot of errors that I found to not appear on the mac.



Related Topics



Leave a reply



Submit