简体   繁体   中英

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.

it worked for me using rvm

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

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed) OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed OpenSSL::SSL::SSLError - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Google Oauth SSL error - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Retrieve PEM cert: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed Heroku Rails Net::HTTP: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed - rake task to external API Mac Omniauth: (google_oauth2) :Faraday::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate B
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM