Can't Get Past Ruby/SSL Issues

1,046 views
Skip to first unread message

Karl

unread,
Nov 15, 2013, 5:15:27 PM11/15/13
to rubyversi...@googlegroups.com
I just can't seem to get past ruby/openssl issues while using RVM.

Config:

Ruby 2.0.0-p247
RVM 1.23.15
OpenSSL 1.0.1e (installed via homebrew)
HTTParty 0.12.0 

Simply, using HTTParty to connect to any https site, always results in:

/Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `connect': Connection reset by peer - SSL_connect (Errno::ECONNRESET)

I have uninstalled ruby 2.0.0-p247, and reinstalled using RVM several times. Tried installing and linking to openssl certs (rvm install 2.0.0 --with-openssl-dir=`brew --prefix openssl`).

Nothing seems to work. Ideas?

mpapis

unread,
Nov 17, 2013, 10:19:32 AM11/17/13
to rubyversi...@googlegroups.com
there is a lot of possibilities for it to go wrong, start with providing a code example and full error output

Karl

unread,
Nov 17, 2013, 11:13:08 AM11/17/13
to rubyversi...@googlegroups.com
➜  ~  rvm info

ruby-2.0.0-p247:

  system:
    uname:       "Darwin Luck-E-Dog-MBP.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64"
    system:      "osx/10.9/x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
    zsh:         "/usr/local/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin12.4.0)"

  rvm:
    version:      "rvm 1.23.15 (stable) by Wayne E. Seguin <xx...@gmail.com>, Michal Papis <xx...@gmail.com> [https://rvm.io/]"
    updated:      "1 day 20 hours 13 minutes 11 seconds ago"
    path:         "/Users/karl/.rvm"

  ruby:
    interpreter:  "ruby"
    version:      "2.0.0p247"
    date:         "2013-06-27"
    platform:     "x86_64-darwin13.0.0"
    patchlevel:   "2013-06-27 revision 41674"
    full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]"

  homes:
    gem:          "/Users/karl/.rvm/gems/ruby-2.0.0-p247"
    ruby:         "/Users/karl/.rvm/rubies/ruby-2.0.0-p247"

  binaries:
    ruby:         "/Users/karl/.rvm/rubies/ruby-2.0.0-p247/bin/ruby"
    irb:          "/Users/karl/.rvm/rubies/ruby-2.0.0-p247/bin/irb"
    gem:          "/Users/karl/.rvm/rubies/ruby-2.0.0-p247/bin/gem"
    rake:         "/Users/karl/.rvm/rubies/ruby-2.0.0-p247/bin/rake"

  environment:
    PATH:         "/Users/karl/.rvm/gems/ruby-2.0.0-p247/bin:/Users/karl/.rvm/gems/ruby-2.0.0-p247@global/bin:/Users/karl/.rvm/rubies/ruby-2.0.0-p247/bin:/Users/karl/.rvm/bin:/usr/local/heroku/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:/Users/karl/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin"
    GEM_HOME:     "/Users/karl/.rvm/gems/ruby-2.0.0-p247"
    GEM_PATH:     "/Users/karl/.rvm/gems/ruby-2.0.0-p247:/Users/karl/.rvm/gems/ruby-2.0.0-p247@global"
    MY_RUBY_HOME: "/Users/karl/.rvm/rubies/ruby-2.0.0-p247"
    IRBRC:        "/Users/karl/.rvm/rubies/ruby-2.0.0-p247/.irbrc"
    RUBYOPT:      ""
    gemset:       ""


# httparty_test.rb
require 'httparty'

HTTParty.post(
            'https://my_private.domain.com',
            basic_auth: { username: 'myname', password: 'sekrit' },
            body: options2.to_json,
            headers: {'Content-Type' => 'application/json'},
            )

➜  ruby httparty_test.rb                                             
/Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `connect': Connection reset by peer - SSL_connect (Errno::ECONNRESET)
from /Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
from /Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `connect'
from /Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /Users/karl/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1367:in `request'
from /Users/karl/.rvm/gems/ruby-2.0.0-p247/gems/httparty-0.12.0/lib/httparty/request.rb:93:in `perform'
from /Users/karl/.rvm/gems/ruby-2.0.0-p247/gems/httparty-0.12.0/lib/httparty.rb:486:in `perform_request'
from /Users/karl/.rvm/gems/ruby-2.0.0-p247/gems/httparty-0.12.0/lib/httparty.rb:439:in `post'
from /Users/karl/.rvm/gems/ruby-2.0.0-p247/gems/httparty-0.12.0/lib/httparty.rb:522:in `post'
from precash.rb:31:in `<main>'

If I do the same in in CURL, or the same ruby code executed from my Ubuntu server, it works as expected.

Let me know if you would like to see anything else.
Karl

mpapis

unread,
Nov 24, 2013, 7:23:47 PM11/24/13
to rubyversi...@googlegroups.com
does your 'https://my_private.domain.com' require extra certificate? did you install it so that the openssl used by ruby can see it?
if it does not require extra cert did you update certificates with: 'rvm osx-ssl-certs-update all'?

Karl

unread,
Nov 24, 2013, 10:44:45 PM11/24/13
to rubyversi...@googlegroups.com
I figured it out... it's an obscure bug between my version of OpenSSL (1.0.1e via/homebrew) and Apache/Tomcat.

Using HTTParty I had tried using different versions of TLS, but I didn't try v3, which works.

Reply all
Reply to author
Forward
0 new messages