1

我正在尝试通过 Typhoeus on Rails 连接到 WebService,响应给了我一个代码 0。它告诉我发生了 ssl_connect_error。

Typhoeus 的文档说要阅读消息详细信息以了解错误的性质。

一段时间后,我可以得到生成的 curl url,并假设我得到了根本错误

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

尽管 DH Key too small 错误,有没有办法获得正确的请求?我要连接的服务器很大,因此不会很快考虑任何需要的升级。

4

2 回答 2

1

一段时间后,我访问了https://imlc.me/dh-key-too-small,它提供了有关如何降低自己的安全级别的说明。

但它也告诉你,你可以添加--cipher 'DEFAULT:!DH到 curl 命令行

现在,要让那个标志在 Typhoeus 中工作,你必须向 Ethon 发送一个关于它的选项。在Ethon Options中,这ssl_cipher_list是一个有效的选项。

所以现在你可以像这样添加ssl_cipher_list到你的Request选项中

request = Typhoeus::Request.new(url,
                                method: method,
                                body: body,
                                headers: headers,
                                params: params,
                                ssl_cipher_list: 'DEFAULT:!DH')
于 2021-05-17T02:24:29.720 回答
0

谢谢,我也必须通过ssl_verifypeer: false,例如:

Typhoeus::Request.new(
  url, 
  method: :get,
  followlocation: true,
  ssl_cipher_list: 'DEFAULT:!DH', 
  ssl_verifypeer: false
)
于 2021-09-08T10:30:45.853 回答