Ubuntu 14.04 Virtualmin 虚拟服务器上的 SSL 显示未知协议

SSL on Ubuntu 14.04 Virtualmin Virtual Server shows unknown protocol

我们有一个服务器 运行ning virtualmin,多个网站位于虚拟服务器中。我以前从未 运行 在我们的其他服务器上遇到过这个问题,但我们发布了 CSR 并从客户端取回 SSL 并安装了它。

安装后我收到了一堆常见的名称错误。这似乎是因为 SSL 中的域包含 www。您不能将其分配给虚拟服务器,因此它不匹配。但是,通过在 /etc/apache2/sites-enabled/example.conf 记录中包含 www.domain.com,错误就消失了。

但是如果我访问网站 https://www.example.com,我会得到一个 ERR_SSL_PROTOCOL_ERROR

我还尝试了 运行以下操作:

openssl s_client -connect www.example.com:443

输出这个:

CONNECTED(00000003)
3073689800:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:759:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 297 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

我查看了 openssl 是否显示端口 443 正在被监听。我还调整了 ports.conf 文件以包含更多细节:

#Listen 80
#Listen 443
NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    NameVirtualHost *:443
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

在 /etc/apache2/sites-enabled/example.conf 中,我确保有一系列针对 443 虚拟服务器的设置,而不仅仅是 80,它包括以下内容:

<VirtualHost 123.123.123.123:443>
SuexecUserGroup "#1000" "#1000"
ServerName www.example.com
ServerAlias example.com
DocumentRoot /home/example/public_html
ErrorLog /var/log/virtualmin/example.com_error_log
CustomLog /var/log/virtualmin/example.com_access_log combined
ScriptAlias /cgi-bin/ /home/example/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/example/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/example/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/example/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/example/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 301
FcgidMaxRequestLen 1073741824
SSLEngine on
SSLCertificateFile /home/example/ssl.cert
SSLCertificateKeyFile /home/example/ssl.key
SSLCACertificateFile /home/example/ssl.ca
</VirtualHost>

我仍然有一个想法是,通过简单地再次执行 CSR 但不在通用名称中使用 www,也许这将解决所有这些问题。但在我回到客户那里之前(我已经去过几次)我想看看这是否真的能解决问题。

更新

所以在昨晚的混乱中我抽空把服务器从12.04升级到了14.04。这使得诊断起来更容易一些,因为我的另一台服务器(上面有大约 20 个站点)工作正常并且在 14.04 上。

我还确保启用 default-ssl.conf 和 000-default.conf 只是为了确保。使用 sudo tail -40 /var/log/apache2/error.log 查看一些 SSL 日志,我能看到的只有一条消息:

[ssl:warn] [pid 6905] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)

我也试过这个:

nmap --script +ssl-enum-ciphers example.com

它显示端口 443 已打开,但没有显示该端口的 ssl-enum-ciphers..

更新 2

尝试了一个新证书。还是不行。但我刚刚通过 Firefox 加载了该网站并看到了这个: ERR_SSL_PROTOCOL_ERROR

如果 Listen 443 打开但 Virtualhost 没有为 443 设置,看起来可能会发生这种情况,但 .conf 文件肯定是..

天哪。

所以我发现了问题。另一个虚拟主机网站也在 443 的虚拟主机文件中包含一个部分。但是该网站未正确配置为使用 SSL,因为它不应该这样做。

我一时兴起,决定删除文件中的 443 条目并重新启动 Apache。现在网站加载正常!