【问题标题】:Let's Encrypt ssl certificate send twice in TLS handshake让我们加密 ssl 证书在 TLS 握手中发送两次
【发布时间】:2018-11-24 06:08:08
【问题描述】:

在进行 wireshark 跟踪以检查我的 Let's Encrypt 证书是否由我们的服务器正确提供时,我看到在“Server Hello Done”时在 TLS 握手中发送了两次相同的证书。

这怎么会发生?如何纠正?

证书细节是2倍完全相同:

请求的额外信息: 我通过在 Fedora 25 客户端上使用 Chrome 浏览器访问我的 Apache 网络服务器(CentOS Linux 版本 7.4.1708 (Core))的 https 页面来跟踪这一点。

虚拟主机配置:

SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /etc/letsencrypt/live/my.domain.tld/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my.domain.tld/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/my.domain.tld/fullchain.pem

不知道这是否重要,但我还有第二个 VirtualHost 具有不同的 Let's Encrypt 证书:

SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite HIGH:MEDIUM
SSLCertificateFile /etc/letsencrypt/live/my2.domain.tld/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my2.domain.tld/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/my2.domain.tld/fullchain.pem

【问题讨论】:

  • 您已将证书名称设为空白。您确定发送了两次确切的证书还是发送了证书链?
  • 我添加了一个额外的屏幕截图。细节是完全相同的2倍。我模糊的域名也是2倍。
  • 证书序列号相同。我为 SSL 问题做了很多线路跟踪,但我从来没有注意过这个。检查您的证书链文件以查看您的 SSL 证书是否是证书链文件的一部分。您可能会发现您的证书位于顶部。您的证书、链和密钥的实际配置取决于使用您未提及的证书的软件。
  • 你没有提供很多细节:客户是什么?它使用哪些 TLS 库?服务器是谁?如果您更改客户端或服务器或证书,您是否有相同的行为?你在一个致力于编程的网站上,所以没有任何程序可以显示你在这里是离题的,应该更多地关注Server Fault
  • 我添加了关于客户端和服务器的额外信息。

标签: ssl lets-encrypt


【解决方案1】:

问题


这是由SSLCertificateFileSSLCertificateChainFile 同时配置引起的。

来自the mod_ssl documentation(强调我的):

此指令设置可选的一体式文件,您可以在其中组装形成服务器证书的证书链的证书颁发机构 (CA) 的证书。 这从服务器证书的颁发 CA 证书开始,范围可高达根 CA 证书。

但是,如果您检查您的 fullchain.pem,您会看到它在顶部包含 服务器 证书,然后是 Let's Encrypt 颁发 CA。 Apache 正在传递SSLCertificateFile 的内容,并在其后连接SSLCertificateChainFile。由于您的服务器证书出现在两者中,因此它在 SSL 握手中看到的最终链中重复,就像您在 Wireshark 中观察到的一样:

   vhost.conf                   Sent To Client 
+---------------+            +------------------+
|   cert.pem    |----------> |Server Certificate|
|               |            |        +         |
|       +       |      +---> |Server Certificate|
|               |      |     |        +         |
| fullchain.pem |----------> | CA Certificate   |
+---------------+            +------------------+

修复


在现代 Apache 中,不要再使用SSLCertificateChainFile 指令了,直接将fullchain.pemSSLCertificateFile

再次,来自the mod_ssl documentation

SSLCertificateChainFile 已弃用

SSLCertificateChainFile 在 2.4.8 版中已过时,当时 SSLCertificateFile 被扩展为还可以从服务器证书文件加载中间 CA 证书。

所以你需要做的就是改变你的虚拟主机配置:

SSLCertificateFile /etc/letsencrypt/live/my.domain.tld/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my.domain.tld/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/my.domain.tld/fullchain.pem

到这里:

SSLCertificateFile /etc/letsencrypt/live/my.domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my.domain.tld/privkey.pem

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-26
    • 2020-07-20
    • 1970-01-01
    • 1970-01-01
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多