如何隐藏Squid主机名称和版本号?
- By : Will
- Category : Forward Proxy
Forward Proxy
1 前言
一个问题,一篇文章,一出故事。
笔者的Squid遇到安全提示,需要隐藏主机名称以及版本号,于是笔者整理此文。
2 最佳实践
2.1 检查当前服务器的状态
curl -I http://squid01.cmdschool.org:3128
可见如下显示,
HTTP/1.1 400 Bad Request Server: squid/6.1 Mime-Version: 1.0 Date: Fri, 14 Jul 2023 01:00:55 GMT Content-Type: text/html;charset=utf-8 Content-Length: 3514 X-Squid-Error: ERR_INVALID_URL 0 Vary: Accept-Language Content-Language: en Cache-Status: squid01.cmdschool.org Via: 1.1 squid01.cmdschool.org (squid/6.1) Connection: close
2.2 隐藏Squid主机名称
vim /etc/squid/squid.conf
加入如下配置,
visible_hostname anonymous
配置修改后,你需要重载使配置生效,
systemctl reload squid.service
2.3 隐藏Squid版本号
vim /etc/squid/squid.conf
加入如下配置,
httpd_suppress_version_string on
配置修改后,你需要重载使配置生效,
systemctl reload squid.service
2.4 验证配置
curl -I http://squid01.cmdschool.org:3128
可见如下显示,
HTTP/1.1 400 Bad Request Server: squid Mime-Version: 1.0 Date: Fri, 14 Jul 2023 01:54:31 GMT Content-Type: text/html;charset=utf-8 Content-Length: 3486 X-Squid-Error: ERR_INVALID_URL 0 Vary: Accept-Language Content-Language: en Cache-Status: anonymous Via: 1.1 anonymous (squid) Connection: close
参阅文档
===================
http://www.squid-cache.org/Doc/config/visible_hostname/
http://www.squid-cache.org/Doc/config/request_header_access/
没有评论