Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed #119

Closed
niaomingjian opened this issue Nov 17, 2016 · 7 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged. windows

Comments

@niaomingjian
Copy link

niaomingjian commented Nov 17, 2016

When I ran Cloud Datastore Sample locally on Win7 x64, I got this error:

 Faraday::SSLError:
   SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
 # ./spec/quickstart_spec.rb:22:in `block (2 levels) in <top (required)>'
 # ------------------
 # --- Caused by: ---
 # OpenSSL::SSL::SSLError:
 #   SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
 #   ./spec/quickstart_spec.rb:22:in `block (2 levels) in <top (required)>'

After I added OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE in quickstart_spec.rb and sample_spec.rb, this example ran successfully.
At the same time, there's a warning: already initialized constant OpenSSL::SSL::VERIFY_PEER in the log.

How to solve this problem correctly?

@beccasaurus
Copy link
Contributor

/cc @blowmage

@blowmage
Copy link
Contributor

This is a common error when ruby is missing the needed SSL certificate configuration. Most ruby installers will add this configuration, but it looks like your install is missing it. The easiest way to resolve this is to check for a SSL_CERT_FILE environment variable. If it is missing, then adding it (and the certificate file it points to) should fix this.

Here are some Stack Overflow questions that may help

http://stackoverflow.com/questions/4528101/ssl-connect-returned-1-errno-0-state-sslv3-read-server-certificate-b-certificat
http://stackoverflow.com/questions/37336526/getting-ssl-error-in-ruby-on-windows

@beccasaurus
Copy link
Contributor

Thanks @blowmage!

@niaomingjian What did you use to install Ruby on your machine?

Google search also turned up this recent post which may help
https://superdevresources.com/ssl-error-ruby-gems-windows/

@niaomingjian
Copy link
Author

@remi I used RubyInstaller to install Ruby 2.3.1.

I tried those solutions before, but they didn't work.

I tried again., downloaded SSL certificate(cacert.pem), put it in Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs directory and set SSL_CERT_FILE environment variable.

Though I could install jekyll successfully, running this datastore example still got that error.

Even I uninstalled Ruby and reinstall it again. I still can't solve this problem.

@blowmage
Copy link
Contributor

Can you post the full backtrace? Datastore uses GRPC to connect to the API, but the error you are reporting is coming from Faraday, and I'm not sure what is using Faraday.

What version of google-cloud are you using?

@frankyn
Copy link
Member

frankyn commented Mar 31, 2017

@niaomingjian can I close this issue? Not sure if this is still an issue moving forward.

@frankyn frankyn closed this as completed Apr 6, 2017
@jepunband
Copy link

help please ..

msf5 auxiliary(gather/shodan_search) > run

[-] Auxiliary failed: OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=error: certificate verify failed
[-] Call stack:
[-] /opt/metasploit-framework/embedded/lib/ruby/2.4.0/net/protocol.rb:44:in connect_nonblock' [-] /opt/metasploit-framework/embedded/lib/ruby/2.4.0/net/protocol.rb:44:in ssl_socket_connect'
[-] /opt/metasploit-framework/embedded/lib/ruby/2.4.0/net/http.rb:948:in connect' [-] /opt/metasploit-framework/embedded/lib/ruby/2.4.0/net/http.rb:887:in do_start'
[-] /opt/metasploit-framework/embedded/lib/ruby/2.4.0/net/http.rb:876:in start' [-] /opt/metasploit-framework/embedded/lib/ruby/2.4.0/net/http.rb:1407:in request'
[-] /opt/metasploit-framework/embedded/framework/modules/auxiliary/gather/shodan_search.rb:59:in shodan_query' [-] /opt/metasploit-framework/embedded/framework/modules/auxiliary/gather/shodan_search.rb:109:in run'
[*] Auxiliary module execution completed

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged. windows
Projects
None yet
Development

No branches or pull requests

6 participants