阿帕奇httpd
与响应数据一起发送的headers之一是"Server“。例如,我的web服务器机器相对来说是最新的Arch .它向后发送与以下内容非常相似的头:
HTTP/1.1 404 Not Found
Date: Thu, 10 Apr 2014 17:19:27 GMT
Server: Apache/2.4.9 (Unix)
Content-Length: 1149
Connection: close
Content-Type: text/html
我在ServerSignature off
中有/etc/httpd/conf/httpd.conf
,但是“服务器:”头仍然出现。我试验过国防部_标头。我已经启用了它,我尝试了几种方法:
<IfModule headers_module>
Header set ProcessingTime "%D"
Header set Server BigJohn
</IfModule>
使用上述配置停止并启动httpd
之后,header包含类似于ProcessingTime: 1523
的内容,但是"Server:“标题行保持不变。因此,我知道"mod_headers“已经安装并启用,并且可以工作,但不是我想要的那样。
我看到一个叫做" mod_security“的东西声称要这么做,但我不想要mod_security随身携带的所有其他行李。
一旦安装了mod_security
,只需要几个指令:
<IfModule security2_module>
SecRuleEngine on
ServerTokens Full
SecServerSignature "Microsoft-IIS/6.0"
</IfModule>
这是针对mod_security
2.7.7的
发布于 2014-04-10 18:31:23
服务器ID/令牌头由"ServerTokens“指令(由mod_core
提供)控制。除了修改Apache源代码或使用mod_security
模块之外,没有其他方法可以完全取消服务器ID头。
使用mod_security
方法,您可以禁用modsecurity.conf
文件中所有模块的指令/函数,并且只利用服务器头ID指令,而不需要任何额外的“行李”。
发布于 2015-03-31 22:55:40
mod_security很棒,但是你并不需要它来实现你的目标。
在httpd.conf
中包含了所有mods之后,您可以简单地取消设置您选择的标题。正如注释中所述,需要启用mod_headers
。
Header unset Server
# if the above doesn't work, set a default value
# use the keyword 'always' to set the header even with error'ed responses
# (e.g. if your app is down)
Header always set Server "No peeking!"
ServerSignature Off
ServerTokens Prod
http://httpd.apache.org/docs/2.4/mod/core.html#serversignature
发布于 2015-10-27 15:18:54
只是为那些还在寻找的人更新这个。我在更改HTTP报头中的Server行时遇到了问题。这个建议应该适用于带有systemd和Apache2.4.7的Debian分支发行版。具体来说,我使用的是Ubuntu 14.04.03。我发现的一些建议是
grep -Ri servertokens /etc/apache2
这导致我找到/etc/apache2/conf-available/security.conf,其中指定了ServerTokens和ServerSignature。因此,我对/etc/apache2/apache2.conf所做的任何更改都会被security.conf中已经指定的指令覆盖。
我只是更改了security.conf中的指令,Apache开始按我的意愿工作。
ServerTokens Prod
ServerSignature Off
在Header unset Server的主题上,我发现了一个bug报告,其中Apache说这是一个不会修复的问题。显然,对于他们来说,这是一个哲学问题,尽管HTTP/1.1规范,RFC 2616部分是由Tim编写的,他说服务器标签是可选的。
我真的想将Server标记设置为“未知”,以使我们的Qualys扫描愉快。因此,我按照本数字海洋教程安装了mod_security,现在称为libasache2-modsecurity。祝你们好运,希望我能帮助你们未来的读者。
https://unix.stackexchange.com/questions/124137
复制相似问题