漏洞修复:在应用程序中发现不必要的 Http 响应头

描述

blablabla描述,一般是在返回的响应表头中出现了Server键值对,那我们要做的就是移除它,解决方案中提供了nginx的解决方案

解决方案

第一种解决方案

当前解决方案会隐藏nginx的版本号,但还是会返回nginx字样,如果想再彻底点,参考第二种解决方案

bash 复制代码
server{
  server_tokens off;
}

or

bash 复制代码
location{
  server_tokens off;
}

第二种解决方案

当前方法需要安装一个插件,所以nginx需要重新编译一下,也可以拿我编译好的nginx,编译版本是centos7 64位
插件:https://github.com/openresty/headers-more-nginx-module

到nginx官网下载nginx后,在编译时增加--add-module=/path/to/headers-more-nginx-module

记得修改/path/to/headers-more-nginx-module为你下载的插件路径

bash 复制代码
wget 'http://nginx.org/download/nginx-1.17.8.tar.gz'
tar -xzvf nginx-1.17.8.tar.gz
cd nginx-1.17.8/

./configure --prefix=/opt/nginx \
    --add-module=/path/to/headers-more-nginx-module

make
make install

编译完成后,在nginx.conf参数中增加,以移除Server键值对

bash 复制代码
server{
   more_clear_headers  "Server";
   more_clear_headers  "server";
}

参考

编译好的nginx

使用7z压缩的exe文件,解压即可

https://www.aliyundrive.com/s/rGr9YQxuhnM

提取码: 1l0f

nginx server tokens 参数描述:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens

插件地址:https://github.com/openresty/headers-more-nginx-module

相关推荐
Johny_Zhao3 小时前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
小毛驴8504 小时前
Linux 后台启动java jar 程序 nohup java -jar
java·linux·jar
好好学习啊天天向上5 小时前
世上最全:ubuntu 上及天河超算上源码编译llvm遇到的坑,cmake,ninja完整过程
linux·运维·ubuntu·自动性能优化
tan180°6 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
典学长编程6 小时前
Linux操作系统从入门到精通!第二天(命令行)
linux·运维·chrome
wuk9987 小时前
基于MATLAB编制的锂离子电池伪二维模型
linux·windows·github
DuelCode7 小时前
Windows VMWare Centos Docker部署Springboot 应用实现文件上传返回文件http链接
java·spring boot·mysql·nginx·docker·centos·mybatis
独行soc9 小时前
#渗透测试#批量漏洞挖掘#HSC Mailinspector 任意文件读取漏洞(CVE-2024-34470)
linux·科技·安全·网络安全·面试·渗透测试
BD_Marathon9 小时前
Ubuntu下Tomcat的配置
linux·ubuntu·tomcat
饥饿的半导体10 小时前
Linux快速入门
linux·运维