伪造Nginx版本号方法 |
为了保障云服务器安全,在使用Linux服务器的时候,一般会对选择降低被攻击的风险,其中伪造Nginx版本号也是保障服务器安全的方法之一。 开启版本号 编辑nginx的配置文件nginx.conf [root@localhost init.d]# vim /usr/local/nginx/conf/nginx.conf http { include mime.types; default_type application/octet-stream; server_tokens on; ##开启版本号 修改Nginx源码包文件nginx.h [root@localhost init.d]# cd /opt/nginx-1.12.2/src/core/ ##切换到src源码包目录 [root@localhost core]# vim nginx.h ##修改文件 #define NGINX_VERSION "1.1.1" ##此处版本号伪造成1.1.1 重新编译 [root@localhost core]# cd /opt/nginx-1.12.2/ ##切换目录到Nginx下 [root@localhost nginx-1.12.2]# ./configure \ ##重新配置 > --prefix=/usr/local/nginx \ > --user=nginx \ > --group=nginx \ > --with-http_stub_status_module [root@localhost nginx-1.12.0]# make ##重新编译 ... [root@localhost nginx-1.12.0]# make install ##重新安装 ... 重启Nginx service nginx restart 查看版本号 [root@localhost nginx-1.12.2]# curl -I 192.168.0.1 HTTP/1.1 200 OK Server: nginx/1.1.1 ##此时的版本号就是伪造的版本号 Date: Tue, 12 Nov 2019 14:34:02 GMT Content-Type: text/html Content-Length: 612 Last-Modified: Tue, 12 Nov 2019 13:46:35 GMT Connection: keep-alive ETag: "5dcab7bb-264" Accept-Ranges: bytes |