google-api-ruby-client icon indicating copy to clipboard operation
google-api-ruby-client copied to clipboard

certificate verify failed (Faraday::SSLError)

Open threewordphrase opened this issue 11 years ago • 39 comments

OSX 10.10.3, Ruby 2.2.1p85, gem version 0.9.pre1

Full error:

/Users/username/.rvm/rubies/ruby-2.2.1/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 (Faraday::SSLError) from /Users/asmith/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:inblock in connect' from /Users/asmith/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:in timeout' from /Users/asmith/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:inconnect' from /Users/asmith/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:863:in do_start' from /Users/asmith/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:852:instart' from /Users/asmith/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:1375:in request' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:82:inperform_request' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:40:in block in call' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:87:inwith_net_http_connection' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:32:in call' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/faraday-0.9.1/lib/faraday/request/url_encoded.rb:15:incall' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/signet-0.6.1/lib/signet/oauth_2/client.rb:957:in fetch_access_token' from /Users/asmith/.rvm/gems/ruby-2.2.1/gems/signet-0.6.1/lib/signet/oauth_2/client.rb:983:infetch_access_token!' from run.rb:17:in `

'

I am able to hotwire with this at the top:

require 'openssl' OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

...but that kinda sucks.

threewordphrase avatar Jul 10 '15 14:07 threewordphrase

See #235 for a workaround. The cert bundle in this library has the correct roots. Setting an env variable will have signet pick it up.

I'll take a look at cleaning up signet so it picks up the correct roots by default next week.

sqrrrl avatar Jul 10 '15 17:07 sqrrrl

I was getting this issue on my Mac too. brew update and then brew upgrade openssl fixed it.

radar avatar Jul 21 '15 01:07 radar

@sqrrrl I think this issue can be closed now as it can be fixed by updating openssl.

radar avatar Jul 30 '15 01:07 radar

@sqrrrl Updating openssl didn't solve this problem for me. I have to set SSL_CERT_FILE to the bundled cacerts.pem file.

asamasoma avatar Aug 06 '15 17:08 asamasoma

FWIW, this is what worked for me:

cert_path = Gem.loaded_specs['google-api-client'].full_gem_path+'/lib/cacerts.pem' ENV['SSL_CERT_FILE'] = cert_path

threewordphrase avatar Aug 07 '15 16:08 threewordphrase

Worth linking: https://github.com/rvm/rvm/issues/3330

Vanuan avatar Sep 24 '15 20:09 Vanuan

FWIW, this is what worked for me:

cert_path = Gem.loaded_specs['google-api-client'].full_gem_path+'/lib/cacerts.pem' ENV['SSL_CERT_FILE'] = cert_path

Thanks crypticsymbols! That worked for me as well on:

ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14] on OS X 10.10.5) google-api-client (0.8.6) googleauth (0.4.2) signet (0.6.1) jwt (1.5.1)

stevestofiel avatar Oct 09 '15 21:10 stevestofiel

@crypticsymbols thanks a lot, that works for me too!

sirkosi avatar Oct 15 '15 11:10 sirkosi

It's far better not to touch any code and fix the damn OS X's ruby 2.2.1 binary.

Vanuan avatar Oct 15 '15 14:10 Vanuan

I agree with @Vanuan, code was just a stopgap measure and the other approach is better.

threewordphrase avatar Oct 15 '15 15:10 threewordphrase

@Vanuan it does not worked for me

psk11 avatar Nov 05 '15 05:11 psk11

Here is what worked for me:

I'm running OS X 10.11.1, Ruby 2.2.1, openssl 1.0.2d_1

Upgrading to Ruby 2.2.3 fixed the problem.

Yenwod avatar Nov 18 '15 17:11 Yenwod

A system wide solution would be this (for Yosemite and Ruby 2.2.1):

Downloading this http://curl.haxx.se/ca/cacert.pem, and saving it replacing /usr/local/etc/openssl/cert.pem. Add export SSL_CERT_FILE=/usr/local/etc/openssl/cert.pem to your .bash_profile. All net::http will pickup on ENV['SSL_CERT_FILE'].

RVM and ruby seems to have an outdated CA cert.

dblommesteijn avatar Jan 08 '16 10:01 dblommesteijn

@dblommesteijn thank, works for me

jb41 avatar Feb 22 '16 00:02 jb41

@stevestofiel went with your fix thanks!

i'm running stock: ruby 2.2.1p85.

bgerd avatar Mar 10 '16 20:03 bgerd

@dblommesteijn Thanks, this solution worked for me. :)

katrusso avatar Mar 12 '16 16:03 katrusso

Just in case anyone still facing issue.. upgrading to Ruby 2.3.0 helped me. (was in 2.2.3)

flyfy1 avatar Mar 29 '16 07:03 flyfy1

Same issues here that everyone else went through.

I'm on El Capitan 10.11 and using version ruby 2.2.0

Tried the cert.pem replacement Tried switching to 2.1.0 and 2.3.0 Tried: rvm osx-ssl-certs update all

What worked for me: rvm reinstall 2.2.0 --disable-binary gem pristine nokogiri --version 1.6.7.2

schanami avatar Mar 29 '16 20:03 schanami

like @flyfy1 upgrading to Ruby 2.3.0 fixed the issue for me as well

mike0416 avatar Mar 30 '16 16:03 mike0416

upgrading ruby to 2.3.0 solved it for me as well

p55 avatar Mar 31 '16 00:03 p55