SSLLabs:严格传输安全 (HSTS):服务器提供了多个 HSTS 标头

SSLLabs:严格传输安全 (HSTS):服务器提供了多个 HSTS 标头

CentOS 6.8

Apache 2.2


我有两个网站 (moodle 和 mahara) 在该服务器上运行。出于某种原因,其中一个 (moodle) 的 ssllabs 测试结果正常,但对于 mahara 网站,我收到此警告:

Strict Transport Security (HSTS) Invalid Server provided more than one HSTS header

这是处理它们两个的 ssl.conf 文件:

#
# This is the Apache server configuration file providing SSL support.
# It contains the configuration directives to instruct the server how to
# serve pages over an https connection. For detailing information about these 
# directives see <URL:http://httpd.apache.org/docs/2.2/mod/mod_ssl.html>
# 
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#

LoadModule ssl_module modules/mod_ssl.so

#
# When we also provide SSL we have to listen to the 
# the HTTPS port in addition.
#
Listen 443

##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is a internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog  builtin

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism 
#   to use and second the expiring timeout (in seconds).
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300

#   Semaphore:
#   Configure the path to the mutual exclusion semaphore the
#   SSL engine uses internally for inter-process synchronization. 
SSLMutex default

#   Pseudo Random Number Generator (PRNG):
#   Configure one or more sources to seed the PRNG of the 
#   SSL library. The seed data should be of good random quality.
#   WARNING! On some platforms /dev/random blocks if not enough entropy
#   is available. This means you then cannot use the /dev/random device
#   because it would lead to very long connection times (as long as
#   it requires to make more entropy available). But usually those
#   platforms additionally provide a /dev/urandom device which doesn't
#   block. So, if available, use this one instead. Read the mod_ssl User
#   Manual for more details.
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random  512
#SSLRandomSeed connect file:/dev/random  512
#SSLRandomSeed connect file:/dev/urandom 512

#
# Use "SSLCryptoDevice" to enable any supported hardware
# accelerators. Use "openssl engine -v" to list supported
# engine names.  NOTE: If you enable an accelerator and the
# server does not start, consult the error logs and ensure
# your accelerator is functioning properly. 
#
SSLCryptoDevice builtin
#SSLCryptoDevice ubsec

##
## SSL Virtual Host Context
##

NameVirtualHost *:443



# Mahara
<VirtualHost *:443>

Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"

DocumentRoot /var/www/html/mahara
ServerName mahara.mydomain.ac.uk:443

ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

SSLEngine on

SSLProtocol all -SSLv2 -SSLv3 -TLSv1.1 -TLSv1

SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!AES256-GCM-SHA384:!AES128-SHA256:!AES256-SHA:!DSS:!DES-CBC3-SHA:!ECDHE-RSA-DES-CBC3-SHA:!DHE-RSA-DES-CBC3-SHA:!AES256-SHA256:!AES128-SHA:!AES128-GCM-SHA256
SSLHonorCipherOrder on

SSLCertificateFile /etc/httpd/ssl_certs/moodle_mydomain_ac_uk.crt
SSLCertificateKeyFile /etc/httpd/ssl_certs/moodle.mydomain.ac.uk.key
SSLCertificateChainFile /etc/httpd/ssl_certs/root/qv_bundle.crt

</VirtualHost>


# Moodle
<VirtualHost *:443>

Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"

DocumentRoot "/var/www/html/moodle"
ServerName moodle.mydomain.ac.uk:443

ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

<IfModule !mod_auth_ntlm_winbind.c>
  LoadModule auth_ntlm_winbind_module modules/mod_auth_ntlm_winbind.so
</IfModule>

<Directory "/var/www/html/moodle/auth/ldap/">
  <FilesMatch "ntlmsso_magic\.php|test\.php">
    NTLMAuth on
    AuthType NTLM
    AuthName "Moodle NTLM Authentication"
    NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"
    NTLMBasicAuthoritative on
    require valid-user
  </FilesMatch>
</Directory>

SSLEngine on

SSLProtocol all -SSLv2 -SSLv3 -TLSv1.1 -TLSv1

SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!AES256-GCM-SHA384:!AES128-SHA256:!AES256-SHA:!DSS:!DES-CBC3-SHA:!ECDHE-RSA-DES-CBC3-SHA:!DHE-RSA-DES-CBC3-SHA:!AES256-SHA256:!AES128-SHA:!AES128-GCM-SHA256
SSLHonorCipherOrder on

SSLCertificateFile /etc/httpd/ssl_certs/moodle_mydomain_ac_uk.crt
SSLCertificateKeyFile /etc/httpd/ssl_certs/moodle.mydomain.ac.uk.key
SSLCertificateChainFile /etc/httpd/ssl_certs/root/qv_bundle.crt

</VirtualHost>      

除了 moodle 虚拟主机有一些关于 winbind 和 ntlm 的额外信息外,我很确定它们是相同的。

有人知道为什么我可能会收到针对其中一个虚拟主机的警告,而另一个却没有收到?

谢谢

答案1

Strict-Transport-Security如果使用 HTTPS,Mahara 会自行设置标头:

htdocs/初始化.php:

header('X-Permitted-Cross-Domain-Policies: master-only');
if (is_https()) {
    header('Strict-Transport-Security: max-age=63072000');

只需从 Apache 配置中删除该 vhost 的标头即可。

相关内容