[英]Let's Encrypt ssl certificate send twice in TLS handshake
在進行 wireshark 跟蹤以檢查我們的服務器是否正確提供了我的 Let's Encrypt 證書時,我看到在“服務器您好完成”時,在 TLS 握手中將發送兩次相同的證書。
這怎么會發生? 如何糾正?
證書詳細信息是 2 倍完全相同:
請求的額外信息:我通過使用我的 Chrome 瀏覽器在 Fedora 25 客戶端上訪問我的 Apache 網絡服務器(CentOS Linux 版本 7.4.1708(核心))的 https 頁面,使用wireshark 進行跟蹤。
虛擬主機配置:
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
這是由SSLCertificateFile
和SSLCertificateChainFile
同時配置引起的。
來自mod_ssl 文檔(重點是我的):
該指令設置可選的多合一文件,您可以在其中組合證書頒發機構 (CA) 的證書,這些證書構成服務器證書的證書鏈。 這從服務器證書的頒發 CA 證書開始,最高可達根 CA 證書。
但是,如果您檢查fullchain.pem
,您會看到它在頂部包含服務器證書,然后是 Let's Encrypt 頒發的 CA。 Apache 正在傳遞SSLCertificateFile
的內容,並在SSLCertificateChainFile
連接SSLCertificateChainFile
。 由於您的服務器證書出現在它們兩個中,因此它在 SSL 握手中看到的最終鏈中被復制,就像您在 Wireshark 中觀察到的一樣:
vhost.conf Sent To Client
+---------------+ +------------------+
| cert.pem |----------> |Server Certificate|
| | | + |
| + | +---> |Server Certificate|
| | | | + |
| fullchain.pem |----------> | CA Certificate |
+---------------+ +------------------+
在現代 Apache 中,不再使用SSLCertificateChainFile
指令,並將fullchain.pem
直接提供給SSLCertificateFile
。
同樣,來自mod_ssl 文檔:
SSLCertificateChainFile 已棄用
SSLCertificateChainFile
在 2.4.8 版中已過時,當時SSLCertificateFile被擴展為還從服務器證書文件加載中間 CA 證書。
所以你需要做的就是改變你的 vhost 配置:
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.