Craig Flannagan
Craig Flannagan

Reputation: 609

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed on Mac

Using Homebrew, on Mac OSX 10.7.5

$ brew install openssl
Error: openssl-1.0.1e already installed

$ rake test.rake
rake aborted!
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I acknowledge that there are other questions like the one in title, but none of the solution seems to work. I have tried those at various points, with no success:

rvm pkg install openssl
rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr
rvm remove 1.9.3
brew install openssl
rvm install 1.9.3 --with-openssl-dir=`brew --prefix openssl`

I decided to check openssl version and noticed this:

$ openssl version
OpenSSL 0.9.8r 8 Feb 2011

Hopefully that is indeed the problem and the fix is as simple as making sure my laptop detects the correct OpenSSL.

But how do I fix this, so I have it use Homebrew's newer OpenSSL instead?

Thanks in advance.

Upvotes: 5

Views: 6610

Answers (4)

SocoM
SocoM

Reputation: 331

it worked for me using rvm

$ rvm osx-ssl-certs status all
$ rvm osx-ssl-certs update all

Upvotes: 15

dabobert
dabobert

Reputation: 939

on my mac running 10.8.3 i had this problem too, however i had a problem with the above solution because when i tried to do rvm get head install 1.9.3

or

rvm requirements 

i got Error running 'requirements_osx_brew_libs_install... which is a nightmare in its own right see Error running 'requirements_osx_brew_libs_install...' on Mac 10.7 for proof

anyway i got it working by doing

wget http://curl.haxx.se/ca/cacert.pem > 
mv cacert.pem /Users/USER/.rvm/usr/ssl/cert.pem

Upvotes: 0

Justin Schier
Justin Schier

Reputation: 524

Building on mpapis's answer, I executed these commands that fixed the problem for me.

$ cd ~
$ rvm get head
$ rvm requirements

This gave me two key pieces of feedback:

Upgrade of RVM in /Users/myuser/.rvm/ is complete.
RVM Reloaded!

and

Installing requirements for osx, might require sudo password.
Updating certificates in '/usr/local/etc/openssl/cert.pem'.

After that, I didn't get the error anymore.

Upvotes: 3

mpapis
mpapis

Reputation: 53178

You need to update certificates:

sudo curl http://curl.haxx.se/ca/cacert.pem -o "$(ruby -ropenssl -e "p OpenSSL::X509::DEFAULT_CERT_FILE")"

Although this is considered to be not safe as the certificates are downloaded without https and there is no way to tell if they were not changed on the way.

RVM has updated code that will use OSX certificates to update the file and will pull automatically dependencies, you can get it with:

rvm get head
rvm install 1.9.3

Upvotes: 1

Related Questions