We had feedback from our pentest report saying we should turn off server tokens. This is stop people being able to see which version of PHP we are using, and limit their ability to target the specific PHP version.
I have added the following to nginx.conf, under the http block:
server_tokens off;
But what tools can I use to check this change has taken affect?
From the manual you know what the setting does:
So your options are:
nginx/1.2.3
any more.A simple check to see the HTTP response headers is to manually connect i.e. with:
telnet www.example.com 80
where the client lines are what you enter:After a bit more googling, I have found curl command can check the server headers which shows both server tokens and php versions:
Thanks to Alexey for pointing out the change needed in PHP.
Also, if you serve PHP projects, you may need to change in
/etc/nginx/{fastcgi,fastcgi_params).conf
Take a look at InSpec, a tool that allows you "turn your compliance, security, and other policy requirements into automated tests."
https://www.inspec.io
It can do all the configuration testing that you need for your Nginx server. Here's one way to test for the existence of the conf file and the value of
server_tokens
:If set correctly, InSpec returns:
If not: