我有一个具有 LE 证书的主机,它在浏览器中运行良好,但我仍然无法使用、、、curl
(libwww-perl)进行连接:openssl
wget
POST
卷曲
# curl -v -3 https://example.com/
* Hostname was NOT found in DNS cache
* Trying 123.123.123.123...
* Connected to example.com (123.123.123.123) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* Unknown SSL protocol error in connection to example.com:443
* Closing connection 0
openssl
# openssl s_client -connect example.com:443
CONNECTED(00000003)
write:errno=104
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 295 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---
获得
# wget --post-data "key=val" -vvv https://example.com/
--2016-05-11 11:19:01-- https://example.com/
Resolving example.com (example.com)... 123.123.123.123
Connecting to example.com (example.com)|123.123.123.123|:443... connected.
Unable to establish SSL connection.
邮政
# echo 'key=val' | POST https://example.com:443
Can't connect to example.com:443
LWP::Protocol::https::Socket: SSL connect attempt failed with unknown error SSL wants a read first at /usr/share/perl5/LWP/Protocol/http.pm line 41, <STDIN> line 1.
Vhost 配置:
<VirtualHost *:443>
ServerName example.com
SSLEngine On
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
SSLVerifyDepth 10
SSLCertificateFile /etc/letsencrypt/live/example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/fullchain.pem
DocumentRoot "/var/www/"
</VirtualHost>
答案1
我认为您的问题与 DNSSEC 有关。该区域存在一条 DS 记录:
[me@risby ~]$ dig ds codestronaut.com
[...]
;; ANSWER SECTION:
codestronaut.com. 86363 IN DS 19465 8 1 42AFC90FE0A61D3993051C55B6C4C35518713921
但 A 记录chat
未签名:
[me@risby ~]$ dig +dnssec +trace chat.codestronaut.com
[...]
codestronaut.com. 172800 IN NS dns1.yandex.net.
codestronaut.com. 172800 IN NS dns2.yandex.net.
codestronaut.com. 86400 IN DS 19465 8 1 42AFC90FE0A61D3993051C55B6C4C35518713921
codestronaut.com. 86400 IN RRSIG DS 8 2 86400 20160517050727 20160510035727 34745 com. Xk/mK5Y8LigJyP+iPF9arhZXKmsDvslfigom/7BZ2orIKHFGAX8/Q9eE O4rRCZPQD82WBssFHf/jcYSUiZrF/j6Ovq4sPbOJbjPUUoHlkOb8uGe/ 3erv6snM8SKVu8eSaE42cj8efvNRZR4S1MMesD5HGG1gMzjQLkTvHiEN wmE=
;; Received 329 bytes from 192.54.112.30#53(h.gtld-servers.net) in 18 ms
chat.codestronaut.com. 21600 IN A 95.158.40.23
;; Received 66 bytes from 2a02:6b8::213#53(dns1.yandex.net) in 66 ms
请注意缺少 的RRSIG
记录chat.codestronaut.com
。这会导致 DNS 查找在某些平台上失败:
[me@risby ~]$ curl https://chat.codestronaut.com
curl: (6) Could not resolve host: chat.codestronaut.com
我认为,除非你修复了 DNS,否则很难让这一切可靠地运行;要么让你的注册商停止发布DS
该区域的记录,要么正确地签署你的区域。我并不是说这是仅有的问题,但拥有一个正常工作的 DNS 几乎是一切否则,包括调试。
编辑:您说您已禁用 DNSSEC,但更改尚未传播(可能需要一天时间,因为旧 DS 记录上的 TTL 为 86400 秒)。使用 DNSSEC 盲客户端,我无法重现您报告的问题,但我注意到您在该系统上运行了 SNI(即,有多个 SSL 证书可用,包括和chat.codestronaut.com
)panel.codestronaut.com
。
curl -v -3
明确不支持 SNI(因为 SNI 是 TLS 的扩展,因此在 SSLv3 中不可用)。 openssl s_client
一旦收到有关 SNI 的警告,就可以正常工作:
[me@lory tmp]$ openssl s_client -connect chat.codestronaut.com:443 -servername chat.codestronaut.com
[...]
Certificate chain
0 s:/CN=chat.codestronaut.com
i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1
1 s:/CN=chat.codestronaut.com
i:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1
2 s:/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X1
i:/O=Digital Signature Trust Co./CN=DST Root CA X3
尽管没有 SNI 标志(-servername ...
),但它还是获得了证书panel.
。
因此,目前你的原始报告“它在浏览器中运行良好,但我仍然无法使用[其他工具]进行连接“似乎可以归结为”它工作正常,除非我使用不适用于此设置的工具进行连接“。这看上去似乎不是什么问题。