| Prochaine révision | Révision précédente |
| doc:httpd [2015/04/22 12:15] – créée bertrand.bonnefoy-claudet | doc:httpd [2016/10/14 17:09] (Version actuelle) – [Exemple : Apache 2.4 sur Debian Jessie] david.sinquin |
|---|
| ====== Apache HTTP Server ====== | ====== Apache HTTP Server ====== |
| |
| Apache HTTP Server (ou juste « Apache ») est un server [[doc:http|HTTP]]. Il est en version 2.2 dans Debian Wheezy et en version 2.4 dans Debian Jessie. La différence est notable car certaines parties de la configuration ont changé. | [[http://httpd.apache.org/|Apache HTTP Server]] (ou juste « Apache ») est un server [[doc:http|HTTP]]. Il est en version 2.2 dans Debian Wheezy et en version 2.4 dans Debian Jessie. La différence est notable car certaines parties de la configuration ont changé. |
| |
| ===== Activer et désactiver un site ===== | ===== Activer et désactiver un site ===== |
| ===== 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**. Exemple : | 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/. |
| |
| <code> | ==== Exemple : Apache 2.4 sur Debian Jessie ==== |
| | |
| | Dans la configuration du vhost : |
| | <file apache /etc/apache2/sites-available/example.conf> |
| <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 |
| | |
| # intermediate configuration, tweak to your needs | |
| SSLProtocol all -SSLv2 -SSLv3 | |
| 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:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA | |
| SSLHonorCipherOrder on | |
| | |
| # HSTS (mod_headers is required) (15768000 seconds = 6 months) | |
| Header always add Strict-Transport-Security "max-age=15768000" | |
| ... | ... |
| </VirtualHost> | </VirtualHost> |
| </code> | </file> |
| | |
| | Les paramètres communs peuvent être avantageusement placés dans un fichier mis à part, mais ce n'est pas obligatoire. |
| | |
| | <file apache /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 |
| | 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 |
| | SSLHonorCipherOrder on |
| | SSLCompression off |
| | |
| | # HSTS (mod_headers is required) (15768000 seconds = 6 months) |
| | Header always add Strict-Transport-Security "max-age=15768000" |
| | |
| | # OCSP Stapling, only in httpd 2.3.3 and later |
| | SSLUseStapling on |
| | SSLStaplingResponderTimeout 5 |
| | SSLStaplingReturnResponderErrors off |
| | SSLStaplingCache shmcb:/var/run/ocsp(128000) |
| | </file> |
| |
| 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/''. | Activer cette configuration séparée avec ''a2enconf''. |