gpt4 book ai didi

ssl - 用于检查服务器是否提供证书的 OpenSSL 命令

转载 作者:太空宇宙 更新时间:2023-11-03 12:37:15 24 4
gpt4 key购买 nike

我正在尝试运行 openssl 命令以缩小尝试从我们的系统发送出站消息时可能出现的 SSL 问题的范围。

我在另一个主题中找到了这个命令:Using openssl to get the certificate from a server

openssl s_client -connect ip:port -prexit

这个结果的输出

CONNECTED(00000003)
15841:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:188:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 121 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

这是否意味着服务器没有提供任何证书?我在不同的 ip:port 上尝试了其他系统,它们成功地提供了证书。

相互身份验证是否会影响带有 -prexit 的此命令?

--更新--

我再次运行命令

openssl s_client -connect ip:port -prexit

我现在收到了这个回复

CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 121 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

我在命令中添加了-ssl3

openssl s_client -connect ip:port -prexit -ssl3

响应:

CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 0 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : SSLv3
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg : None
Krb5 Principal: None
Start Time: 1403907236
Timeout : 7200 (sec)
Verify return code: 0 (ok)
---

同时尝试 -tls1

CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 0 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg : None
Krb5 Principal: None
Start Time: 1403907267
Timeout : 7200 (sec)
Verify return code: 0 (ok)
---

最佳答案

我今天正在调试一个 SSL 问题,它导致了同样的 write:errno=104 错误。最终我发现这种行为的原因是服务器需要 SNI(servername TLS 扩展)才能正常工作。向 openssl 提供 -servername 选项使其连接成功:

openssl s_client -connect domain.tld:443 -servername domain.tld

关于ssl - 用于检查服务器是否提供证书的 OpenSSL 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24457408/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com