« Security/Services/Apache » : différence entre les versions
Aller à la navigation
Aller à la recherche
(Page créée avec « = Sécuriser son serveur Apache = == PHP == Ajout de la ligne suivante au fichier <path>/etc/php.ini</path> expose_php = Off ») |
(→PHP) |
||
| Ligne 2 : | Ligne 2 : | ||
== PHP == | == PHP == | ||
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. | |||
<syntaxhighlight lang="bash"> | |||
nc localhost 80 << EOF | |||
HEAD http://localhost/index.php http/1.1 | |||
host: localhost | |||
EOF | |||
</syntaxhighlight> | |||
Apache répond en spécifiant le numéro de version de php | |||
<syntaxhighlight lang="text"> | |||
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 | |||
</syntaxhighlight> | |||
Ajout de la ligne suivante au fichier <path>/etc/php.ini</path> | Ajout de la ligne suivante au fichier <path>/etc/php.ini</path> | ||
expose_php = Off | expose_php = Off | ||
Après la modification et un restart d'Apache plus tard | |||
<syntaxhighlight lang="bash"> | |||
nc localhost 80 << EOF | |||
HEAD http://localhost/index.php http/1.1 | |||
host: localhost | |||
EOF | |||
</syntaxhighlight> | |||
Cette fois le numéro de version de php est caché | |||
<syntaxhighlight lang="text"> | |||
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 | |||
</syntaxhighlight> | |||
Version du 6 septembre 2012 à 10:21
Sécuriser son serveur Apache
PHP
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