title: Ruby: SSL_connect SYSCALL returned=5 errno=0 state=unknown state (OpenSSL::SSL::SSLError)
body: <p>Variants of this error have been posted all over the place but none of the solutions seem to work for me.</p>
  
  <p>I'm running <code>ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]</code> and
  <code>OpenSSL 1.0.1k 8 Jan 2015</code>.</p>
  
  <p>Running the following:</p>
  
  <pre><code>require 'net/http'
  require 'openssl'
  
  url = 'https://ntpnow.com/'
  uri   = URI.parse(url)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  http.ssl_version = :TLSv1
  http.get(uri.path)
  </code></pre>
  
  <p>Dumps this trace:</p>
  
  <pre><code>/usr/local/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect SYSCALL returned=5 errno=0 state=unknown state (OpenSSL::SSL::SSLError)
      from /usr/local/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
      from /usr/local/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
      from /usr/local/lib/ruby/2.2.0/net/http.rb:923:in `connect'
      from /usr/local/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
      from /usr/local/lib/ruby/2.2.0/net/http.rb:852:in `start'
      from /usr/local/lib/ruby/2.2.0/net/http.rb:1375:in `request'
      from /usr/local/lib/ruby/2.2.0/net/http.rb:1133:in `get'
      from bin/ntpnow_test.rb:9:in `&lt;main&gt;'
  </code></pre>
  
  <p>Navigating to the site from a browser shows the certificate appears to be fine.  Curl also does not produce any errors.</p>
  
  <p>Additionally, when I try with Ruby 1.9.3 it seems to work.  However, I'm not inclined to downgrade Ruby versions if I can find a solution. </p>
  
  <p>Can you please tell me what exactly changed that is causing this problem?</p>
  
  <p>UPDATE:</p>
  
  <p>Steffen's answer and explanation below is correct.  For future reference, here is how to diagnose this problem.</p>
  
  <ol>
  <li>First determine which ciphers the server supports.  Run the command <code>nmap --script ssl-enum-ciphers ntpnow.com</code>.  Find the section that lists the supported ciphers.</li>
  <li>Determine the cipher key you will have to pass as part of <code>http.ciphers</code>.  Run  <code>openssl ciphers</code>.  This will spit out a <code>:</code> delimited list of ciphers.  Find the one that matches the result from step 1.</li>
  </ol>