LetsEncrypt SSL 错误 - SSL 例程:ssl3_get_record:版本号错误

Zak*_*lwe 6 apache ssl openssl

我设法从 LetsEncrypt 中提取了一个新证书。我的 VirtualHost 配置设置为:

<VirtualHost *:80>
    ServerName example.com
    Redirect 301 / https://example.com/
</VirtualHost>

<VirtualHost *:443>
    Servername example.com
    DocumentRoot /var/www/example.com/wav
    ErrorLog /var/log/apache2/example.com/www/error.log

    SSLEngine On
    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

尝试使用 openssl 验证这一点时:

openssl s_client -connect example.com -port 443
Run Code Online (Sandbox Code Playgroud)

我得到以下信息:

CONNECTED(00000003)
140229655213824: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 202 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: 1541086087
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: no
Run Code Online (Sandbox Code Playgroud)

所以,看起来握手没问题,但没有发送证书。

值得指出的是,Apache 日志不会报告任何错误——只是通常的——“启动/关闭”消息。apache2ctl configtest报告没有问题。

Ste*_*ich 4

所以,看起来握手没问题,但证书没有发送。

握手不太好。客户端已发送 ClientHello 来开始握手,但没有收到任何有用的回复:

                                            |- ClientHello
                                           ---
SSL handshake has read 5 bytes and written 202 bytes
                      ---
                       |- nothing useful from server
Run Code Online (Sandbox Code Playgroud)

我不知道这 5 个字节返回了什么,但它看起来不像 TLS(对于 TLS 消息来说太短了)。这可能是一些服务器配置错误,从您显示的配置部分无法看出。也可能是某些中间件(防火墙、负载均衡器......)损害了连接。也可能是您没有连接到预期的服务器(即example.com没有解析到您的实际服务器)。

我建议您首先检查服务器本身(即localhost),如果这有效,请进一步远离服务器进行检查。您还可以进行数据包捕获,并查看在客户端收到的 5 个字节中会发现什么。