title: Ruby/SSL:sslv3 alert handshake failure
body: <p>Please note I have reviewed as many of the articles on here about this issue and the sample/example code I am showing is one of a dozen variations I have tried based on my reading. So please don't RTFM or the like.</p>
  
  <p>I am writing a simple ruby script to log in/logout of a web app. Unfortunately it is https, and in my attempts it seems like ssl is a much harder "easy programming" scenario than I thought.</p>
  
  <p>I am running this script on a stock Kali installation. I am justing Ruby 1.9.1. The error I am getting is:</p>
  
  <pre><code>/usr/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read finished A: sslv3 alert handshake failure (OpenSSL::SSL::SSLError)
      from /usr/lib/ruby/1.9.1/net/http.rb:799:in `block in connect'
      from /usr/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
      from /usr/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
      from /usr/lib/ruby/1.9.1/net/http.rb:799:in `connect'
      from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
      from /usr/lib/ruby/1.9.1/net/http.rb:744:in `start'
      from ./capture_ids.rb:27:in `block in &lt;main&gt;'
      from ./capture_ids.rb:18:in `each'
      from ./capture_ids.rb:18:in `&lt;main&gt;'
  </code></pre>
  
  <p>Here is my ruby script:</p>
  
  <pre><code>#!/usr/bin/env ruby
  
  require 'net/http'
  require 'net/https'
  require 'openssl'
  
  puts OpenSSL::OPENSSL_VERSION
  puts "SSL_CERT_FILE: %s" % OpenSSL::X509::DEFAULT_CERT_FILE
  puts "SSL_CERT_DIR: %s" % OpenSSL::X509::DEFAULT_CERT_DIR
  
  login_str = "https://192.168.0.251/~login_handler?UserName=foo&amp;Password=bar"
  logout_str = "https://192.168.0.251/~logout_handler?session_id="
  
  seqids = Array.new
  
  puts "Starting capture..."
  puts "Staring loop..."
  for num in 0..2 do
          puts "doing iteration #{num}"
          uri = URI.parse(login_str)
          https = Net::HTTP.new(uri.host, uri.port)
          https.use_ssl = true
  #       https.cert_store = OpenSSL::X509::Store.new
  #       https.cert_store.set_default_paths
          https.verify_mode = OpenSSL::SSL::VERIFY_NONE
          req = Net::HTTP::Post.new(uri.path)
          https.start {
                  res = https.request(req)
          }
  #       puts "*********** Here is the response ***************"
  #       puts res
  #       puts "*********** End of response ********************"
          start_pt = res.index("name=")
          end_pt = res.index(" src=")
          seq_id = res.slice(start_pt, end_pt)
          puts "Sequence id is " + seq_id
          seqids &lt;&lt; seq_id
          uri = URI.parse(logout_str)
          https = Net::HTTP::new(uri.host, uri.port)
          https.use_ssl = true
  #       https.cert_store = OpenSSL::X509::Store.new
  #       https.cert_store.set_default_paths
          https.verify_mode = OpenSSL::SSL::VERIFY_NONE
          req = Net::HTTP::Get.new(uri.path)
          https.start {
                  https.request(req)
          }
  end
  </code></pre>
  
  <p>My SSL dir/certs are:</p>
  
  <p>SSL_CERT_FILE: /usr/lib/ssl/cert.pem
  SSL_CERT_DIR: /usr/lib/ssl/certs</p>
  
  <p>And yes I have confirmed things are there. I also have tried to download new cert files and ca files and use them and put them in there.
  What magic ju ju beads do I have to shake?</p>