CentOS 6.8
Apache 2.2
У меня есть два веб-сайта, работающие с этого сервера (moodle и mahara). По какой-то причине тесты ssllabs возвращаются нормально для одного из них (moodle), но для веб-сайта 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, я почти уверен, что они идентичны.
Кто-нибудь знает, почему я могу получать это предупреждение для одного из виртуальных хостов, но не для другого?
Спасибо
Махара устанавливает Strict-Transport-Security
заголовок сам по себе, если используется HTTPS:
header('X-Permitted-Cross-Domain-Policies: master-only');
if (is_https()) {
header('Strict-Transport-Security: max-age=63072000');
Просто удалите заголовок из конфигурации Apache для этого виртуального хоста.