nginx 简单防护
在nginx.conf添加map
# 定义 User-Agent 黑名单映射
map $http_user_agent $blocked_ua {
default 0;
# 原始列表
"~*curl" 1;
"~*wget" 1;
"~*python" 1;
"~*Go-http-client" 1;
# 常见扫描工具
"~*HTTrack" 1;
"~*WinHTTP" 1;
"~*Xenu" 1;
"~*LinkScan" 1;
"~*libwww" 1;
"~*BBBike" 1;
"~*sqlmap" 1;
"~*CensysInspect" 1;
# 安全扫描工具
"~*masscan" 1;
"~*nmap" 1;
"~*nikto" 1;
"~*OpenVAS" 1;
"~*Metasploit" 1;
"~*BurpSuite" 1;
# 其他常见恶意 UA
"~*zgrab" 1;
"~*ZAP" 1;
"~*Acunetix" 1;
"~*Arachni" 1;
"~*dirbuster" 1;
"~*fimap" 1;
"~*L9Explore" 1;
"~*Custom-AsyncHttpClient" 1;
"~*WebSiphon" 1;
}
其他一些
RealCyber-enricher
l9scan
ClaudeBot
dotbot
SemrushBot
在站点对应配置文件添加规则
# 拦截空UA
if ($http_user_agent = "") {
return 444;
}
# 拦截特定UA
if ($blocked_ua) {
return 444;
}
# 静态站不存在 php,凡是请求 php 的一律断开
if ($uri ~* \.php$) {
return 444;
}
浙公网安备 33010602011771号