apache - LetsEncrypt SSL 错误 - SSL 例程 :ssl3_get_record:wrong version number

标签 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>

尝试使用 openssl 验证时:

openssl s_client -connect example.com -port 443

我得到以下信息:

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

因此,看起来握手没问题,但未发送证书。

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

最佳答案

So, looks like the handshake is okay but the cert isn't being sent.

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

                                            |- ClientHello
                                           ---
SSL handshake has read 5 bytes and written 202 bytes
                      ---
                       |- nothing useful from server

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

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

关于apache - LetsEncrypt SSL 错误 - SSL 例程 :ssl3_get_record:wrong version number,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53104734/

相关文章:

javascript - React ES6 App - 本地 API 调用

apache - 无法访问 Letsencrypt SSL 站点

apache - 通过 Content-Type 设置标题

regex - 仅匹配管理子文件夹时的 Nginx HTTPS

编码/配置 OpenSSL 服务器以获得最大兼容性

ruby - Mechanize 的 SSL 错误

tomcat - 将本地 CA 签名的证书导入 tomcat7 keystore.ks 时是否需要第 5 步?

php - 如何确保JPEG图像有效并且可以被PHP处理?

windows - 尝试在 Windows 上的 Kafka 中实现 SSL/TLS 时出现 java.lang.OutOfMemory 错误

java - 如何修复无效的 SSL 记录内容类型