I've been struggling with this problem for a while now. I am trying to use Rest-Client ruby gem to hit an API endpoint using SSL certs. I know for sure that the server is responding only to TLSv_1_2 and TLSv_1_1, however I can't seem to be able to make it work. This is the snippet of the code:
resource = RestClient::Resource.new(
endpoint,
:ssl_client_cert => OpenSSL::X509::Certificate.new(File.read(config["cert"])),
:ssl_client_key => OpenSSL::PKey::RSA.new(File.read(config["key"])),
:ssl_version => :TLSv1_2,
:verify_mode => OpenSSL::SSL::VERIFY_PEER
)
response = resource.delete(:params => {:name => 'test'})
p endpoint + " | " + response.code.to_s
That's what I get:
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server hello A (OpenSSL::SSL::SSLError)
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:923:in `connect'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:852:in `start'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rest-client-1.8.0/lib/restclient/request.rb:413:in `transmit'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in `execute'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in `execute'
from /usr/local/rvm/gems/ruby-2.2.1/gems/rest-client-1.8.0/lib/restclient
from test.rb:47:in `<main>'
I've been looking at this for a while, but it hasn't helped much.