等同于 denyhosts,但是对于 HTTP 请求?

sla*_*acy 7 linux spam web-server brute-force-attacks apache-2.2

我的 Web 服务器 (apache2) 不断受到恶意机器人的攻击,要求提供以下 URL:

   /blog/tag/pnphpbb2//index.php?name=PNphpBB2&file=posting&mode=quote/index.php?name=PNphpBB2&file=viewtopic&p=34004/viewtopic.php?p=15&sid=be4c914eb746ac7c96beea717fdfc692/&highlight=../../../../../../../../../../../../../etc/passwd%00 HTTP Response 301

   //index.php?name=PNphpBB2&file=posting&mode=quote/index.php?name=PNphpBB2&file=viewtopic&p=34004/viewtopic.php?p=15&sid=be4c914eb746ac7c96beea717fdfc692/&highlight=../../../../../../../../../../../../../etc/passwd%00 HTTP Response 200

   /wiki/index.php/Main:Some_Wiki_Pagename//index.php?name=PNphpBB2&file=posting&mode=quote/index.php?name=PNphpBB2&file=viewtopic&p=34004/viewtopic.php?p=15&sid=be4c914eb746ac7c96beea717fdfc692/&highlight=../../../../../../../../../../../../../etc/passwd%00 HTTP Response 200

   /wiki/index.php//index.php?name=PNphpBB2&file=posting&mode=quote/index.php?name=PNphpBB2&file=viewtopic&p=34004/viewtopic.php?p=15&sid=be4c914eb746ac7c96beea717fdfc692/&highlight=../../../../../../../../../../../../../etc/passwd%00 HTTP Response 200

   /blog/2009/01/title-of-post-here//index.php?name=PNphpBB2&file=posting&mode=quote/index.php?name=PNphpBB2&file=viewtopic&p=34004/viewtopic.php?p=15&sid=be4c914eb746ac7c96beea717fdfc692/&highlight=../../../../../../../../../../../../../etc/passwd%00 HTTP Response 301
Run Code Online (Sandbox Code Playgroud)

我想要一个每晚的 cron 进程来查找任何请求“恶意”URL 的主机,并将它们添加到与 hosts.deny 等效的 HTTP 中。

我想会有一组定义恶意 URL 的正则表达式,可能还有一些 apache 插件可以轻松地拒绝主机(无需每晚重新启动 httpd)。

这样的东西存在吗?

Dav*_*ley 7

http://www.modsecurity.org/可以做你想做的。


rkt*_*hkr 7

fail2ban 扫描日志文件,如 /var/log/apache/error_log 并禁止基于正则表达式(称为过滤器)进行这些自动扫描的 IP。默认情况下,它会更新防火墙 (iptables) 以阻止违规 IP。编写新操作非常容易,并且实现一个更新 .htaccess 的操作应该非常简单,fail2ban 发行版中有几个示例可用。