Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
doc:httpd [2015/05/16 13:32] – [TLS] Configuration pour Apache 2.4 david.sinquin | doc:httpd [2016/10/14 19:09] (Version actuelle) – [Exemple : Apache 2.4 sur Debian Jessie] david.sinquin |
---|
===== TLS ===== | ===== TLS ===== |
| |
Pour la configuration TLS, on peut utiliser le générateur de Mozilla : https://mozilla.github.io/server-side-tls/ssl-config-generator/. Pour HSTS, il faut activer le module **headers**. | D'une manière générale, TLS est compliqué à configurer. Mozilla fournit donc un outil qui s'adapte aux versions de différents systèmes et serveurs : https://mozilla.github.io/server-side-tls/ssl-config-generator/. |
| |
Pour éviter de les répéter dans chaque fichier de site, les paramètres généraux comme **SSLProtocol**, **SSLCipherSuite** et **SSLHonorCipherOrder** peuvent être mis dans ''/etc/apache/conf.d/''. | ==== Exemple : Apache 2.4 sur Debian Jessie ==== |
| |
La configuration ci-dessous s'applique aux versions d'apache et openssl de jessie, consultez le lien si ce n'est pas votre cas. | Dans la configuration du vhost : |
| <file apache /etc/apache2/sites-available/example.conf> |
On mettra donc, par exemple, dans la configuration du VHOST : | |
<code> | |
<VirtualHost *:443> | <VirtualHost *:443> |
... | ... |
SSLEngine on | SSLEngine on |
SSLCertificateFile /path/to/signed_certificate | SSLCertificateFile /path/to/certificate |
SSLCertificateChainFile /path/to/intermediate_certificate | SSLCertificateChainFile /path/to/intermediate_certificate |
SSLCertificateKeyFile /path/to/private/key | SSLCertificateKeyFile /path/to/private/key |
SSLCACertificateFile /path/to/all_ca_certs | SSLCACertificateFile /path/to/ca_certificate |
... | ... |
</VirtualHost> | </VirtualHost> |
</code> | </file> |
et dans ''/etc/apache2/conf-available/tls.conf'' : | |
# modern configuration : https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=apache-2.4.10&openssl=1.0.1k&hsts=yes&profile=modern | Les paramètres communs peuvent être avantageusement placés dans un fichier mis à part, mais ce n'est pas obligatoire. |
SSLProtocol all -SSLv3 -TLSv1 | |
SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK | <file apache /etc/apache2/conf-available/tls.conf> |
SSLHonorCipherOrder on | # modern configuration : https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=apache-2.4.10&openssl=1.0.1k&hsts=yes&profile=modern |
SSLCompression off | SSLProtocol all -SSLv3 -TLSv1 |
| SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK |
# HSTS (mod_headers is required) (15768000 seconds = 6 months) | SSLHonorCipherOrder on |
Header always add Strict-Transport-Security "max-age=15768000" | SSLCompression off |
| |
# OCSP Stapling, only in httpd 2.3.3 and later | # HSTS (mod_headers is required) (15768000 seconds = 6 months) |
SSLUseStapling on | Header always add Strict-Transport-Security "max-age=15768000" |
SSLStaplingResponderTimeout 5 | |
SSLStaplingReturnResponderErrors off | # OCSP Stapling, only in httpd 2.3.3 and later |
SSLStaplingCache shmcb:/var/run/ocsp(128000) | SSLUseStapling on |
| SSLStaplingResponderTimeout 5 |
| SSLStaplingReturnResponderErrors off |
| SSLStaplingCache shmcb:/var/run/ocsp(128000) |
| </file> |
| |
On n'oubliera pas pour finir d'activer la configuration avec ''a2enconf''. | Activer cette configuration séparée avec ''a2enconf''. |