![自签名 TLS1.2 证书握手失败](https://linux22.com/image/689485/%E8%87%AA%E7%AD%BE%E5%90%8D%20TLS1.2%20%E8%AF%81%E4%B9%A6%E6%8F%A1%E6%89%8B%E5%A4%B1%E8%B4%A5.png)
我一直尝试按照本教程在我的 Debian 安装上设置自签名 SSL 证书https://www.digitalocean.com/community/tutorials/how-to-create-an-ecc-certificate-on-nginx-for-debian-8但连接时出现以下错误:
openssl s_client -connect vpsipaddr:443 -state -debug
CONNECTED(00000003)
SSL_connect:before/connect initialization
write to 0x7d3380 [0x7d3f10] (289 bytes => 289 (0x121))
0000 - 16 03 01 01 1c 01 00 01-18 03 03 62 c4 ec 46 0b ...........b..F.
0010 - 47 d3 35 9a f1 b4 54 11-fe 85 66 b8 e7 70 a2 e6 G.5...T...f..p..
0020 - 1e 4c 57 11 75 81 86 be-53 d6 0e 00 00 82 c0 30 .LW.u...S......0
0030 - c0 2c c0 28 c0 24 c0 14-c0 0a 00 a3 00 9f 00 6b .,.(.$.........k
0040 - 00 6a 00 39 00 38 00 88-00 87 c0 32 c0 2e c0 2a .j.9.8.....2...*
0050 - c0 26 c0 0f c0 05 00 9d-00 3d 00 35 00 84 c0 2f .&.......=.5.../
0060 - c0 2b c0 27 c0 23 c0 13-c0 09 00 a2 00 9e 00 67 .+.'.#.........g
0070 - 00 40 00 33 00 32 00 9a-00 99 00 45 00 44 c0 31 [email protected]
0080 - c0 2d c0 29 c0 25 c0 0e-c0 04 00 9c 00 3c 00 2f .-.).%.......<./
0090 - 00 96 00 41 c0 11 c0 07-c0 0c c0 02 00 05 00 04 ...A............
00a0 - c0 12 c0 08 00 16 00 13-c0 0d c0 03 00 0a 00 ff ................
00b0 - 01 00 00 6d 00 0b 00 04-03 00 01 02 00 0a 00 34 ...m...........4
00c0 - 00 32 00 0e 00 0d 00 19-00 0b 00 0c 00 18 00 09 .2..............
00d0 - 00 0a 00 16 00 17 00 08-00 06 00 07 00 14 00 15 ................
00e0 - 00 04 00 05 00 12 00 13-00 01 00 02 00 03 00 0f ................
00f0 - 00 10 00 11 00 23 00 00-00 0d 00 20 00 1e 06 01 .....#..... ....
0100 - 06 02 06 03 05 01 05 02-05 03 04 01 04 02 04 03 ................
0110 - 03 01 03 02 03 03 02 01-02 02 02 03 00 0f 00 01 ................
0120 - 01 .
SSL_connect:SSLv2/v3 write client hello A
read from 0x7d3380 [0x7d9470] (7 bytes => 0 (0x0))
139916497704592:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 289 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1.2
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1473161145
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
我在其他任何地方都找不到答案,尽管我尝试过,但不太清楚如何调试错误。谢谢!
答案1
SSL_connect:SSLv2/v3 write client hello A
read from 0x7d3380 [0x7d9470] (7 bytes => 0 (0x0))
139916497704592:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
服务器在收到 ClientHello 后直接关闭连接。发生这种情况的原因有多种:
- 服务器需要 SNI 扩展。尝试使用
-servername hostname
已配置主机名(而非 IP 地址)的选项,看看这是否有助于建立连接。 - 服务器配置错误,例如证书设置错误,甚至端口 443 上根本没有 SSL。请查看服务器的 error_log 和 access_log 以获取更多信息。其他类型的错误设置可能是密码或协议的选择,但通常会出现不同的错误。