当 Apache error.log 没有显示任何错误时,我该如何进一步调试 curl 错误?
(35)gnutls_handshake() 失败:收到了意外的 TLS 数据包。
curl -v https://example.com
* Rebuilt URL to: https://example.com/
* Trying 127.0.0.1...
* Connected to example.com(127.0.0.1) port 443 (#0)
* found 151 certificates in /etc/ssl/certs/ca-certificates.crt
* found 612 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: An unexpected TLS packet was received.
* Closing connection 0
Ubuntu 16.04,apache2 使用 SSL。
更新:
echo | openssl s_client -connect example.com:443
CONNECTED(00000003)
139626124003072:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:252:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 176 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1531383152
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: no
---
更新2-已解决
我的链文件中有一行空白,并且 RootCA 没有正确安装在我运行 openssl 命令的服务器上。
答案1
我的链文件中有一个空白行,并且 RootCA 未正确安装在我运行 openssl 命令的服务器上。修复后 curl 工作正常。