1

考虑到 Pingdom 是一个声誉很高的网站,我尝试订阅他们的正常运行时间监控服务。然而,即使我设置了 5 分钟的间隔,他们的机器人Pingdom.com_bot_version_1.4仍然不是每秒一次,而是每秒数十次!导致每分钟数千次访问!

然后我试图完全取消服务,但仍然被他们的机器人轰炸。我试图阻止 robots.txt,但显然他们扼杀了它。接下来,我尝试使用以下命令阻止 nginx.conf:

if ($http_user_agent ~* Pingdom.com_bot) {
        return 403;
}

它有效,但我在 access.log 中看到很多 503 错误。如何不记录这个机器人?真的真的很烦。我很遗憾曾经订阅过他们的服务。

4

1 回答 1

0

这是一篇关于阻止 w00tw00t的帖子,您可以轻松采用。

您适应的最简单的选择可能是使用 fail2ban 之一。

使用失败正则表达式触发您的 403 错误。

所以像

[Definition]
failregex =  ^<HOST> .* "(GET|POST|HEAD).*HTTP.*" 403 [0-9]{1,} ".+" ".+"$
ignoreregex=

在 /etc/fail2ban/filter.d/nginx-pindotban.conf

[pingdotban]
enabled = true
port = http,https
filter = nginx-pingdotban
logpath = /path/to/nginx/access.log
maxretry = 5
bantime = 360000

在 /etc/fail2ban/jail.conf

您可以使用

fail2ban-regex logfile /etc/fail2ban/filter.d/nging-pingdotban.conf

也可以采用 iptable 变体,例如

iptables -A INPUT -p tcp --dport 80 -m string --algo bm --string "the useragent" -j DROP
于 2014-08-12T18:33:31.267 回答