如何在CentOS 8/RHEL 8上关闭Apache服务器签名
时间:2020-03-21 11:42:11 来源:igfitidea点击:
当我们在攻击者检查服务器签名时在相应的Enterprise Linux上安装Apache Web Server时,它将显示相应的Enterprise Linux上的Apache Web Server的版本。
它显示了完整的Web服务器详细信息,包括程序包名称和版本号。
本教程将逐步介绍Apache的设置。
步骤1(检查服务器签名)
注意:Apache Web服务器已安装。
确保它正在运行。
首先检查以获取服务器签名。
给定的curl命令对于检查的标题响应很有用。
的响应代码向我们显示服务器签名的详细信息。
# curl --head http://theitroad.com
输出示例
HTTP/1.1 403 Forbidden Date: Wed, 29 Jun 2015 16:52:55 GMT Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 Last-Modified: Thu, 16 Oct 2014 13:20:58 GMT ETag: "1321-5058a1e728280" Accept-Ranges: bytes Content-Length: 4897 Content-Type: text/html; charset=UTF-8
然后,给定的行显示在Apache Web服务器上启用了服务器签名
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9
步骤2(处理Apache Web服务器的禁用服务器令牌)
其次,Apache配置文件显示服务器令牌,这对于禁用服务器令牌很有用。
# vim /etc/httpd/conf/httpd.conf
现在,将这些行添加到配置文件的最后一行。
术语prod表示生产环境中的生产系统。
ServerTokens Prod
完成重启后,Apache Web Server
# systemctl restart httpd
步骤3(检查服务器签名)
最后,现在更改所有配置。
请继续执行curl命令以检查apache Web服务器的响应。
# curl --head http://theitroad.com
HTTP/1.1 403 Forbidden Date: Wed, 29 Jun 2015 17:10:25 GMT Server: Apache Last-Modified: Thu, 16 Oct 2014 13:20:58 GMT ETag: "1321-5058a1e728280" Accept-Ranges: bytes Content-Length: 4897 Content-Type: text/html; charset=UTF-8
给定的行显示服务器签名已禁用。
禁用Apache Web服务器打印。
Server: Apache
现在我们已在CentOS和RHEL上关闭了Apache服务器签名。