我们从我们的pentest报告中得到反馈,说我们应该closures服务器令牌。 这是阻止人们能够看到我们正在使用哪个版本的PHP,并限制他们针对特定PHP版本的能力。
我已经添加了下面的nginx.conf,http块:
server_tokens off;
但是,我可以使用什么工具来检查此更改是否已经生效?
从手册你知道什么设置:
语法 :
server_tokens on | offserver_tokens on | off
默认值 :server_tokens on;
上下文 :http,服务器,位置在错误消息和“服务器”响应头字段中启用或禁用发送nginx版本。
所以你的select是:
nginx/1.2.3 。 查看HTTP响应头的简单检查是手动连接,例如: telnet www.example.com 80客户端行是您input的内容:
客户端:HEAD / HTTP / 1.1
客户端:主机:www.example.com服务器:HTTP / 1.1 200 OK
服务器:date:星期三,1970年1月1日22:13:05 GMT
服务器: 服务器:Nginx / 1.2.3
服务器:连接:closures
服务器:内容types:文本/ HTML
多一点search后,我发现curl命令可以检查显示服务器令牌和php版本的服务器头:
curl -I -L www.example.com
感谢Alexey指出了PHP所需的改变。
HTTP/1.1 301 Moved Permanently Server: nginx Date: Thu, 04 Jun 2015 10:49:35 GMT Content-Type: text/html Content-Length: 178 Connection: keep-alive Location: https://www.example.com HTTP/1.1 200 OK Server: nginx Date: Thu, 04 Jun 2015 10:49:36 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive Expires: Sun, 19 Nov 1978 05:00:00 GMT Last-Modified: Thu, 04 Jun 2015 10:49:35 GMT Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0 ETag: "1433414975" Content-Language: en