【问题标题】:SSL on Ubuntu 14.04 Virtualmin Virtual Server shows unknown protocolUbuntu 14.04 Virtualmin 虚拟服务器上的 SSL 显示未知协议
【发布时间】:2019-01-14 22:54:37
【问题描述】:

我们有一台运行 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 文件肯定是..

【问题讨论】:

  • 检查服务器配置的 SSL 版本。您可能正在请求未配置的版本。 “www”不是问题。在这种情况下,您会收到不匹配错误。
  • 看起来像 SSLv3 和 TLSv1.2,如何检查证书需要什么?
  • 我确实奇怪地看到 Apache.conf 中的默认设置是 SSLv2..
  • FWIW,这是一个有效的 apache vhost 配置。我没有声称它是最佳或完美的,但它正在工作:pastebin.com/Fvdz0sMA
  • 谢谢我试了一下,但它实际上让 apache 停止工作。

标签: apache ssl ubuntu-14.04 virtualmin


【解决方案1】:

我的天啊。

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

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

【讨论】:

    猜你喜欢
    • 2016-08-03
    • 2014-10-12
    • 1970-01-01
    • 2015-11-22
    • 2018-08-09
    • 1970-01-01
    • 2019-03-28
    • 2017-04-07
    • 1970-01-01
    相关资源
    最近更新 更多