Apache 2.4.8+ 上的 SSLCertificateChainFile 弃用警告

DOO*_*iac 15 certificate mod-ssl ssl-certificate apache-2.4

我们有来自 Network Solutions 的网站 SSL 证书。将 Apache/OpenSSL 升级到 2.4.9 版后,我现在在启动 HTTPD 时收到以下警告:

AH02559: The SSLCertificateChainFile directive (/etc/httpd/conf.d/ssl.conf:105) is deprecated, SSLCertificateFile should be used instead
Run Code Online (Sandbox Code Playgroud)

根据mod_sslApache 手册情况确实如此:

SSLCertificateChainFile 已弃用

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

查找SSLCertificateFile的文档,看起来我只需要将我对SSLCertificateChainFile 的调用替换SSLCertificateFile调用

此更改使我的 ssl.conf 从此:

SSLCertificateFile /etc/ssl/STAR.EXAMPLE.COM.crt
SSLCertificateKeyFile /etc/ssl/server.key
SSLCertificateChainFile /etc/ssl/Apache_Plesk_Install.txt
Run Code Online (Sandbox Code Playgroud)

对此:

SSLCertificateFile /etc/ssl/STAR.EXAMPLE.COM.crt
SSLCertificateFile /etc/ssl/Apache_Plesk_Install.txt
SSLCertificateKeyFile /etc/ssl/server.key
Run Code Online (Sandbox Code Playgroud)

......但这不起作用。Apache 只是在没有任何错误消息的情况下拒绝启动。

我不确定在这里还可以尝试什么,因为我对 mod_ssl 或 SSL 证书一般不太熟悉。我记得我们需要为 Internet Explorer添加Apache_Plesk_Install.txt文件才能在我们的站点上没有 SSL 警告,但除此之外一无所知

任何帮助将不胜感激。谢谢。

小智 9

我遇到过同样的问题。我只是替换了这些行/etc/apache2/site-enabled/default-ssl.conf

SSLCertificateFile    /etc/ssl/certs/domain.crt
SSLCertificateKeyFile /etc/ssl/private/domain.key
#SSLCertificateChainFile /etc/apache2/ssl.crt/chain.crt
Run Code Online (Sandbox Code Playgroud)

如您所见,我刚刚注释掉了SSLCertificateChainFile. 然后,看到了同样的错误,你,我串联我的内容chain.crt 在最后domain.crt,就像这样:

root@host~: cat /etc/apache2/ssl.crt/chain.crt >> /etc/ssl/certs/domain.crt
Run Code Online (Sandbox Code Playgroud)

它就像一个魅力。


小智 6

我使用以下脚本创建一个包含链式证书的证书包。

#!/bin/sh
#
# Convert PEM Certificate to ca-bundle.crt format
#

test ! $1 && printf "Usage: `basename $0` certificate" && exit 1

# Friendly Name and Underline Friendly Name with equal signs
openssl x509 -in $1 -text -noout | sed -e 's/^  *Subject:.*CN=\([^,]*\).*/\1/p;t  c' -e 'd;:c' -e 's/./=/g'
# Output Fingerprint and swap = for :
openssl x509 -in $1 -noout -fingerprint | sed -e 's/=/: /'
# Output PEM Data:
echo 'PEM Data:'
# Output Certificate
openssl x509 -in $1
# Output Certificate text swapping Certificate with Certificate Ingredients
openssl x509 -in $1 -text -noout | sed -e 's/^Certificate:/Certificate Ingredients:/'
Run Code Online (Sandbox Code Playgroud)

要使用它,从服务器证书开始,然后依次通过证书链中的任何中间证书回到根证书。

./bundle.sh myserver.crt >myserver.chain
./bundle.sh intermediate.crt >>myserver.chain
./bundle.sh root.crt >>myserver.chain
Run Code Online (Sandbox Code Playgroud)

其中适当的证书名称替换为您的真实证书名称。