简体   繁体   English

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

[英]LetsEncrypt SSL Error - SSL routines:ssl3_get_record:wrong version number

I've managed to pull down a fresh cert from LetsEncrypt.我设法从 LetsEncrypt 中提取了一个新证书。 My VirtualHost config is set up as:我的 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>

When trying to verify this with openssl:尝试使用 openssl 验证这一点时:

openssl s_client -connect example.com -port 443

I get the following:我得到以下信息:

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

So, looks like the handshake is okay but the cert isn't being sent.所以,看起来握手没问题,但没有发送证书。

Worth pointing out that the Apache logs don't report any errors - just the usual - "starting up/shutting down" messages.值得指出的是,Apache 日志不会报告任何错误——只是通常的——“启动/关闭”消息。 apache2ctl configtest reports no issues. apache2ctl configtest报告没有问题。

So, looks like the handshake is okay but the cert isn't being sent.所以,看起来握手没问题,但没有发送证书。

The handshake is not ok.握手不行。 The Client has sent the ClientHello to start the handshake but received nothing useful back:客户端已发送 ClientHello 开始握手,但没有收到任何有用的回复:

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

I don't know what it is getting back in the 5 bytes but it does not look like TLS (too short for a TLS message).我不知道它在 5 个字节中返回了什么,但它看起来不像 TLS(对于 TLS 消息来说太短了)。 It might be some server misconfiguration which can not be seen from the part of the config you've shown.这可能是一些服务器配置错误,从您显示的配置部分看不到。 It might also be some middlebox (firewall, load balancer...) hurting the connection.也可能是一些中间件(防火墙、负载平衡器...)损害了连接。 It might also be that you don't connect to the expected server (ie example.com does not resolve to your actual server).也可能是您没有连接到预期的服务器(即example.com没有解析到您的实际服务器)。

I recommend that you first check on the server itself (ie localhost ) and if this works move further away from the server with your checks.我建议您首先检查服务器本身(即localhost ),如果这有效,请通过检查远离服务器。 You might also do a packet capture and have a look what you'll find in the 5 bytes received by the client.您还可以进行数据包捕获,并查看在客户端收到的 5 个字节中您会发现什么。

Just sharing for anyone who ends up here with the same problem.只是分享给最终遇到同样问题的任何人。

This is my experience in Ubuntu 20 with Apache这是我在 Ubuntu 20 和 Apache 中的经验

I was editing the default-ssl.conf in SITES-AVAILABLE folder but nothing happened.我正在编辑 SITES-AVAILABLE 文件夹中的 default-ssl.conf 但什么也没发生。 The above same error was repeating no matter what i did.无论我做什么,上述相同的错误都会重复出现。

I copied the default-ssl.conf from sites-available into SITES-ENABLED folder without the IfModule mod_ssl.c tag and THAT SOLVED THE PROBLEM.我将 default-ssl.conf 从 sites-available 复制到 SITES-ENABLED 文件夹中,没有 IfModule mod_ssl.c 标签,这解决了问题。

Hope this info helps someone.希望这些信息可以帮助某人。

Thanks谢谢

I had the same issue.我遇到过同样的问题。 My example.com.conf file did have HTTPS set up properly, but my 000-default.conf file did not.我的example.com.conf文件确实正确设置了 HTTPS,但我的000-default.conf文件没有。 I seemed to have forgotten to include the SSL certificate and turn on the SSL engine for my 000-default.conf , but after I fixed that, it worked perfectly.我似乎忘记了包含 SSL 证书并为我的000-default.conf开启 SSL 引擎,但是在我修复它之后,它运行良好。

The code I added to 000-default.conf :我添加到000-default.conf的代码:

SSLEngine On
SSLCertificateFile /etc/ssl/example.com/domain.cert.pem
SSLCertificateKeyFile /etc/ssl/example.com/private.key.pem

I got the same error with you.我和你有同样的错误。 suggest you test your https connection on local, add your domain name to /etc/hosts, ex: 127.0.0.1 yourdomain.com in order to keep packet not going out.建议您在本地测试您的 https 连接,将您的域名添加到 /etc/hosts,例如:127.0.0.1 yourdomain.com 以保持数据包不出去。

then using "links" to test the https connection in local environment, if no problem, then it's caused by ISP firewall issue or setting, I finally found local https connection ok and throw the problem to ISP to solve this problem finally, good luck!然后使用“links”测试本地环境下的https连接,如果没有问题,则是ISP防火墙问题或设置引起的,我终于发现本地https连接可以了,最后把问题扔给ISP解决了这个问题,祝你好运!

set your file types for ssl as well, this is confirmed working See the FilesMatch section?也为 ssl 设置文件类型,这已确认有效 查看 FilesMatch 部分? If that is missing, you will see this error.如果缺少,您将看到此错误。

SSLEngine on
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
SSLCertificateFile /etc/letsencrypt/live/mysite.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.net/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLHonorCipherOrder on
SSLProtocol all -SSLv2 -SSLv3
#SSLCipherSuite EECDH+AES:EDH+AES:-SHA1:EECDH+RC4:EDH+RC4:RC4-SHA:EECDH+AES256:EDH+AES256:AES256-SHA:!aNULL:!eNULL:!EXP:!LOW:!MD5
#SSLCipherSuite "AES256-SHA"
SSLCipherSuite HIGH:!aNULL:!MD5

It seems apache's default *:80 HTTP handler will also listen on 443 for unmatched VirtualHost IPs including loopback.似乎 apache 的默认 *:80 HTTP 处理程序也将在 443 上侦听不匹配的 VirtualHost IP,包括环回。

For example, my machine has a NAT ip 192.168.32.5 and of course the 127.0.0.1 loopback.例如,我的机器有一个 NAT ip 192.168.32.5,当然还有 127.0.0.1 环回。 If my site conf uses <VirtualHost 192.168.32.5:443> then any requests that resolve to 127.0.0.1:443 are actually answered by the default HTTP handler...not HTTPS.如果我的站点 conf 使用 <VirtualHost 192.168.32.5:443> 那么任何解析为 127.0.0.1:443 的请求实际上都由默认的 HTTP 处理程序响应......而不是 HTTPS。 Simply setting my hosts entry for the SSL hostname to 192.168.32.5 fixed the issue.只需将 SSL 主机名的 hosts 条目设置为 192.168.32.5 即可解决该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM