多个 Apache 托管站点的选择性 ERR_SSL_VERSION_OR_CIPHER_MISMATCH 错误
Posted
技术标签:
【中文标题】多个 Apache 托管站点的选择性 ERR_SSL_VERSION_OR_CIPHER_MISMATCH 错误【英文标题】:Selective ERR_SSL_VERSION_OR_CIPHER_MISMATCH error with multiple Apache-hosted sites 【发布时间】:2020-06-11 20:18:19 【问题描述】:我有几个在 Apache 上运行的主机名,我希望为其配置特定的强 TLS 配置。在 Apache 中启用了 2 个.conf
文件:第一个包含端口 80 的所有虚拟主机(例如 default.conf
),另一个存储端口 443 的相应虚拟主机(default443.conf
)。
可以通过 https:// 仅访问来自default.conf
的第一个 VirtualHost 的主机名。所有剩余的主机都在任何网络浏览器中抛出 ERR_SSL_VERSION_OR_CIPHER_MISMATCH。当通过curl
访问这样一个失败的主机名时,会出现以下错误:
curl: (35) error:14094410:SSL routines:ssl3_read_bytes:sslv3 警报握手失败
default.conf
:
Protocols h2 h2c http/1.1
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/example
RewriteEngine on
RewriteRule ^(.*)$ https://%HTTP_HOST$1 [R=301,L]
#RewriteRule ^(.*)$ https://example.com$1 [R=301,L]
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/html/example2
RewriteEngine on
RewriteRule ^(.*)$ https://example2.com$1 [R=301,L]
ErrorLog $APACHE_LOG_DIR/error.log
CustomLog $APACHE_LOG_DIR/access.log combined
</VirtualHost>
default443.conf
:
Protocols h2 h2c http/1.1
<VirtualHost *:443>
ServerName example.com
DocumentRoot /var/www/html/example
RewriteEngine on
SSLOpenSSLConfCmd ECDHParameters secp384r1
SSLOpenSSLConfCmd Curves secp384r1
SSLEngine On
SSLCertificateFile /path/to/example.crt
SSLCertificateKeyFile /path/to/example.key
Header always set Strict-Transport-Security "max-age=63072000"
</VirtualHost>
<VirtualHost *:443>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/html/example2
RewriteEngine on
RewriteCond %SERVER_PORT 443
RewriteCond %HTTP_HOST www\.example2\.com$
RewriteRule ^(.*)$ https://example2.com$1 [R=301,L]
SSLEngine On
SSLCertificateFile /path/to/example2.crt
SSLCertificateKeyFile /path/to/example2.key
Header always set Strict-Transport-Security "max-age=63072000"
</VirtualHost>
SSLProtocol -all +TLSv1.2
SSLCipherSuite -all:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
根据上述配置,example.com 正在通过 https:// 正确解析,使用在 example2.com 的 SSL 握手失败时声明的密码套件。
如果评论我们的 SSLCipherSuite
指令或将密码套件替换为用于 TLS 1.2 的 suggested by Mozilla,example2.com 也可以通过 https:// 正常工作。
apachectl -v 服务器版本:Apache/2.4.41
openssl 版本 OpenSSL 1.1.1c 2019 年 5 月 28 日
我想弄清楚为什么只有一个主机名通过 https:// 正常运行,而其余的主机名在声明 ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305
密码的情况下不断收到失败的 SSL 握手。
【问题讨论】:
【参考方案1】:经过一番研究,分辨率似乎很明显。
为正常工作的主机名安装了 ECDSA SSL/TLS 证书(列表中的example.com
),而所有其他主机都安装了带有 RSA 私钥的证书。
由于声明的密码套件仅用于 ECDSA 身份验证 (1) (2),因此使用 RSA 私钥的主机握手失败。
用 EC 密钥重新颁发剩余的证书解决了这个问题。
【讨论】:
以上是关于多个 Apache 托管站点的选择性 ERR_SSL_VERSION_OR_CIPHER_MISMATCH 错误的主要内容,如果未能解决你的问题,请参考以下文章
具有多个 wordpress 博客的 Apache 虚拟主机
windows2012安装apache怎么配置多个站点使用不同的php版本呢?
apache_conf 加速WordPress自托管站点。此内容在#BEGIN WordPress之前进入.htaccess文件。