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 connection issues #202

Closed
dkam opened this issue May 1, 2014 · 4 comments
Closed

OpenSSL connection issues #202

dkam opened this issue May 1, 2014 · 4 comments

Comments

@dkam
Copy link

dkam commented May 1, 2014

On MacOS 10.9.2 and Ubuntu 12.04 using RBenv installed Ruby 2.1.1, I can't connect via https to a specific host with HTTPClient - however both Curl and open-uri can.

c = HTTPClient.new
c.get("https://www.qbd.com.au/")
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: sslv3 alert handshake failure

Opening with either open-uri or the locally install Curl works fine, which I suspect means the local CA files are ok?

@aef
Copy link

aef commented May 5, 2014

HTTPS uses TLS to provide security like authentiticy and encryption. Versions of TLS before 1999 were called SSL. The server you try to connect to only supports TLSv1 and above but not SSLv3 anymore. SSLv3 has several security vulnerabilities and will therefore be disabled on more and more servers. Sadly, instead of using the best supported TLS version (which for recent Ruby versions is at least TLSv1), httpclient by default is set to use only SSLv3. I think this is a big problem and needs to be adressed. In the meantime you can manually override this:

c = HTTPClient.new
c.ssl_config.ssl_version = :TLSv1
c.get("https://www.qbd.com.au/")

You can find out which versions are supported by your Ruby implementation by calling this command:

ruby -ropenssl -rpp -e "pp OpenSSL::SSL::SSLContext::METHODS"

You should use the highest version available.

@dkam
Copy link
Author

dkam commented May 5, 2014

Thank you very much!

@dkam dkam closed this as completed May 5, 2014
@nahi
Copy link
Owner

nahi commented Oct 15, 2014

Thanks @dkam and @aef, the fix for this is incorporated in httpclient/2.4.0 by 1753454 (by @aef)

Now POODLE Attacks on SSLv3 comes: https://www.imperialviolet.org/2014/10/14/poodle.html
SSL/TLS servers quickly disabling SSLv3 (It's protocol vulnerability and no server side fix is possible so far) so httpclient <= 2.3.4.1 would cause SSL handshake errors like "SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: sslv3 alert handshake failure"

Solution:

  • Upgrade to httpclient/2.4.0
  • Set ssl_config.ssl_version to SSLv23
c = HTTPClient.new
c.ssl_config.ssl_version = :SSLv23

@nahi
Copy link
Owner

nahi commented Oct 15, 2014

To disable SSLv3 completely, add this instead of SSLv23

c.ssl_config.options |= OpenSSL::SSL::OP_NO_SSLv3

coderberry pushed a commit to coderberry/vimeo that referenced this issue Oct 21, 2014
This is a security patch. With the latest version of httpclient, if you
use this gem in an app already using httpclient, you will still be able
to apply the security patch referenced here:

nahi/httpclient#202 (comment)
coderberry pushed a commit to coderberry/vimeo that referenced this issue Oct 21, 2014
This is a security patch. With the latest version of httpclient, if you
use this gem in an app already using httpclient, you will still be able
to apply the security patch referenced here:

nahi/httpclient#202 (comment)

Also removed Gemfile.lock and added the file to .gitignore. It is not
good to check in Gemfile.lock into version control, since it enforces
precision that does not exist in the gem command, which is used to
install gems in practice.

See http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
coderberry pushed a commit to coderberry/vimeo that referenced this issue Oct 21, 2014
This is a security patch. With the latest version of httpclient, if you
use this gem in an app already using httpclient, you will still be able
to apply the security patch referenced here:

nahi/httpclient#202 (comment)

Also removed Gemfile.lock and added the file to .gitignore. It is not
good to check in Gemfile.lock into version control, since it enforces
precision that does not exist in the gem command, which is used to
install gems in practice.

See http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
gorenje pushed a commit to wooga/helpshift.gem that referenced this issue Oct 8, 2015
elifoster added a commit to CleverbotIO/ruby-cleverbot.io that referenced this issue Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants