是否有命令检查主机站点所需的TLS版本.现在,我知道检查的唯一方法是调整浏览器的最大TLS版本并检查我是否仍然可以访问该网站.但是,我怀疑有一种更复杂的方法可以做到这一点.
Col*_*tin 22
从https://maxchadwick.xyz/blog/checking-ssl-tls-version-support-of-remote-host-from-command-line:
nmap ssl-enum-ciphers
检查 SSL / TLS 版本支持的另一个选项是 nmap。默认情况下通常不会安装 nmap,因此您需要手动安装它。安装后,您可以使用以下命令检查 SSL / TLS 版本支持...
$ nmap --script ssl-enum-ciphers -p 443 www.google.com
nmap 的 ssl-enum-ciphers 脚本不仅会一次性检查所有版本(TLS 1.0、TLS 1.1 和 TLS 1.2)的 SSL/TLS 版本支持,还会检查每个版本的密码支持,包括提供等级。
man*_*nuj 18
你可以使用以下命令检查
对于tls 1.2
openssl s_client -connect www.google.com:443 -tls1_2
对于tls 1.1
openssl s_client -connect www.google.com:443 -tls1_1
为tls 1
openssl s_client -connect www.google.com:443 -tls1
如果您获得证书链和握手,则支持tls版本.如果你没有看到证书链,以及类似于"握手错误"的东西,那就不是了.
我喜欢使用curl它可以很好地报告 TLS 版本协商。
例如,这尝试连接 TLS 1.1,服务器协商升级到 1.2:
$ curl -Iiv --tlsv1.1 https://example.com
* Trying 192.168.205.11:443...
* TCP_NODELAY set
* Connected to example.com (192.168.205.11) 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.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
[...]
Run Code Online (Sandbox Code Playgroud)
要禁止服务器升级 TLS 版本,请使用以下--tls-max选项:
$ curl -Iiv --tlsv1.1 --tls-max 1.1 https://example.com
* Trying 192.168.205.11:443...
* TCP_NODELAY set
* Connected to example.com (192.168.205.11) 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 alert, internal error (592):
* error:141E70BF:SSL routines:tls_construct_client_hello:no protocols available
* Closing connection 0
curl: (35) error:141E70BF:SSL routines:tls_construct_client_hello:no protocols available
Run Code Online (Sandbox Code Playgroud)
在这种情况下,连接会失败,因为客户端不提供任何高于 1.1 的 TLS 版本,但服务器不接受任何低于 1.2 的版本 ( no protocols available)。如果像这样使用,输出与 openssl_client 输出非常相似。
| 归档时间: |
|
| 查看次数: |
24812 次 |
| 最近记录: |