ssl - GET 请求 ssl_choose_client_version :unsupported protocol

标签 ssl curl

我在处理对远程服务器执行 GET 请求的应用程序升级时遇到问题。
首先要做的事: 完成的 GET 的功能示例老 版本,并且正如预期的那样有效

curl -k -vvvvv https://mywebsite.com/mywonderfulwebsite/mypage.php

*   Trying 192.168.0.70...
* TCP_NODELAY set
* Connected to mywebsite.com (192.168.0.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.0 (IN), TLS handshake, Certificate (11):
* TLSv1.0 (IN), TLS handshake, Server finished (14):
* TLSv1.0 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.0 (OUT), TLS change cipher, Client hello (1):
* TLSv1.0 (OUT), TLS handshake, Finished (20):
* TLSv1.0 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.0 / AES128-SHA
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=MYWEBSITE.COM
*  start date: Mar 24 10:20:51 2020 GMT
*  expire date: Mar 24 00:00:00 2021 GMT
*  issuer: CN=MYWEBSITE.COM
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> GET /mywonderfulwebsite/mypage.php HTTP/1.1
> Host: mywebsite.com
> User-Agent: curl/7.58.0
> Accept: */*
....... and here the content of the page.....
现在从新版本开始,它不起作用
curl -vvvvv https://mywebsite.com/mywonderfulwebsite/mypage.php
*   Trying 192.168.0.70:443...
* TCP_NODELAY set
* Connected to mywebsite.com (192.168.0.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS alert, protocol version (582):
* error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
* Closing connection 0
curl: (35) error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
所以我认为它来自 TLS 版本,没问题让我们强制它:
curl --tlsv1.0 -vvvvv https://mywebsite.com/mywonderfulwebsite/mypage.php

*   Trying 192.168.0.70:443...
* TCP_NODELAY set
* Connected to mywebsite.com (192.168.0.70) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS alert, protocol version (582):
* error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
* Closing connection 0
curl: (35) error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
这是失败的。
我试过从远程网站添加证书,我有同样的答案。
我查看了使用 openssl 客户端的请求:
# openssl s_client -connect mywebsite.com:443 -tls1
CONNECTED(00000003)
139820362433856:error:141E70BF:SSL routines:tls_construct_client_hello:no protocols available:../ssl/statem/statem_clnt.c:1112:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 7 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
现在我正在使用版本和请求,但我不知道应该在哪里检查。
你知道我该如何解决我的问题吗?

最佳答案

这是解决方案:https://askubuntu.com/questions/1233186/ubuntu-20-04-how-to-set-lower-ssl-security-level
后期的 openssl 包被配置为禁止使用 TLS < 1.2 但是,第一个 curl 请求显示使用 TLS 1.0 的通信
所以在 debian Buster 中,openssl 包太新了

dpkg -l | grep openssl
ii  openssl                       1.1.1d-0+deb10u7
我不必降级 Openssl
编辑/etc/ssl/openssl.cnf
在文件开头添加
openssl_conf = default_conf
这到文件的末尾
[ default_conf ]

ssl_conf = ssl_sect

[ssl_sect]

system_default = system_default_sect

[system_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT:@SECLEVEL=1
更改配置允许使用最低版本的 TSL,从 TSL 1.0 及更高版本开始,因此从现在开始我可以请求我的旧版合作伙伴。

关于ssl - GET 请求 ssl_choose_client_version :unsupported protocol,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70042160/

相关文章:

bash - 在 Bash 的/dev/tcp 中使用 SSL

curl - 如何禁用命令行 Curl TCP_NODELAY 选项?

php - 如何让cURL不显示请求页面的正文?

php - CURL 发出请求时出错 : SSL connect error (error code: 35)

Javascript - 链接 2 个(或更多)promise 数组

php - 有没有更好的方法来使用 Youtube PHP API

ssl - nginx - 记录 SSL 握手失败

ssl - 无法删除 Google 管理的 SSL 证书

java - 将证书链写入 PEM 文件

java - 从本地机器到 AWS RDS PostgreSQL 数据库的连接速度非常慢