Typhoeus ssl_connect_error

387 Views Asked by At

I am trying to connect to a WebService via Typhoeus on Rails and the response is giving me a code 0. It tells me that an ssl_connect_error has ocurred.

Typhoeus' documentation says to read the message detail to understand the nature of the error.

After some time I could get the generated curl url and given that I got the undelying error

error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small

Is there a way to get a correct request despite the DH Key too small error? The server I am trying to connect to is a big one, so any needed upgrade won't be taken into account anytime soon.

2

There are 2 best solutions below

0
On BEST ANSWER

After some sometime I reached into https://imlc.me/dh-key-too-small where it gives directions on how to lower one's own security level.

But it also tell you that you can add the --cipher 'DEFAULT:!DH into curl command line

Now, to get that flag working in Typhoeus, you have to send an option to Ethon about it. In Ethon Options the ssl_cipher_list is a valid option.

So now you can just add ssl_cipher_list into your Request options like so

request = Typhoeus::Request.new(url,
                                method: method,
                                body: body,
                                headers: headers,
                                params: params,
                                ssl_cipher_list: 'DEFAULT:!DH')
0
On

Thanks, I also had to pass ssl_verifypeer: false, like:

Typhoeus::Request.new(
  url, 
  method: :get,
  followlocation: true,
  ssl_cipher_list: 'DEFAULT:!DH', 
  ssl_verifypeer: false
)