无法在 apache 上关闭 SNI

2 http-headers sni apache-2.2

当我访问:http : //web-sniffer.net/并检查我网站的标题 ( https://www.example.org ) 时,我收到状态代码 200

但是当我使用单选按钮 HTTP/1.0(没有 Host 标头)时,我得到一个状态代码 400(错误请求)。

我的 apache 日志显示“通过 SNI 提供的主机名 www.example.org,但 HTTP 请求中没有提供主机名”

我读了它以使其工作我需要关闭我的apache conf文件中的指令“SSLStrictSNIVHostCheck”。

我添加了这个指令,但是在创建 HTTP/1.0(没有主机头)时仍然得到状态代码 400

作为参考,这是我的 ports.conf 文件:

ServerName www.example.org

NameVirtualHost *:80
Listen 10.0.0.1: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.
    Listen 443
    NameVirtualHost *:443
    SSLStrictSNIVHostCheck off
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>
Run Code Online (Sandbox Code Playgroud)

这是我的默认 ssl 文件:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName www.example.org
    ServerAdmin webmaster@example.org
    SSLStrictSNIVHostCheck off


    Alias /static /home/ubuntu/public_html/static
    <Directory /home/ubuntu/public_html/static>
        Order deny,allow
        Allow from all
</Directory>

Alias /media /home/ubuntu/public_html/media
<Directory /home/ubuntu/public_html/media >
        Order deny,allow
        Allow from all
</Directory>

WSGIScriptAlias / /home/ubuntu/public_html/apache.wsgi

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

SSLProtocol all -SSLv2
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM

SSLCertificateFile /etc/ssl/crt/example_org.crt
SSLCertificateKeyFile /etc/ssl/crt/server.key
SSLCertificateChainFile /etc/ssl/crt/ca.crt
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
</Directory>

BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
Run Code Online (Sandbox Code Playgroud)

Mic*_*ton 6

据我查看Apache 源代码可以看出,您不能使用任何Apache 配置选项来做到这一点。您必须发送一个 Host: 标头,与通过 SNI 发送的内容相匹配,以便 Apache 接受它。

RFC 6066 第 11.1 节指定 Web 服务器必须检查 Host: 标头和通过 SNI 发送的主机名是否匹配。

实际上,过去 15 年左右产生的任何使用 HTTP 的软件都应该在每个请求中发送 Host: 标头。如果您确实拥有一些不存在的东西,那么它要么太古老而无法继续存在于 Internet 上,要么已损坏。