Security/Services/Apache
Aller à la navigation
Aller à la recherche
Sécuriser son serveur Apache
PHP
Cacher le numéro de version
PHP expose son numéro de version ( par défaut ? ). En effet il suffit de lancer la commande suivante pour s'en rendre compte. Bien entendu le fichier index.php doit exister, sinon Apache rapporte une erreur 404.
nc localhost 80 << EOF
HEAD http://localhost/index.php http/1.1
host: localhost
EOF
Apache répond en spécifiant le numéro de version de php
HTTP/1.1 200 OK
Date: Thu, 06 Sep 2012 10:03:22 GMT
Server: Apache
X-Powered-By: PHP/5.4.6
Connection: close
Content-Type: text/html; charset=UTF-8
Ajout de la ligne suivante au fichier <path>/etc/php.ini</path>
expose_php = Off
Après la modification et un restart d'Apache plus tard
nc localhost 80 << EOF
HEAD http://localhost/index.php http/1.1
host: localhost
EOF
Cette fois le numéro de version de php est caché
HTTP/1.1 200 OK
Date: Thu, 06 Sep 2012 10:03:22 GMT
Server: Apache
Connection: close
Content-Type: text/html; charset=UTF-8