2

我在我的服务器上收到了来自不同 IP 地址的太多请求。我发现,观看 apache access.log,所有这些 IP 地址都在请求一个特定的文件(teXeFe.php)。我想阻止对所有这些 IP 地址的访问。我该怎么做?

4

2 回答 2

6

如何使用 iptables 字符串匹配?

就像是,

iptables -I INPUT 1 -m string --algo bm --string "teXeFe.php" -j DROP

我将规则插入到位置 1 只是为了进行测试,因为如果它被插入到更远的位置,我还有其他匹配的规则在此之前。无论如何,你明白这个概念。您也可以在规则中更具体一点(包括 GET /full/url/path 等)。

这是描述字符串匹配过滤器的页面,
- http://spamcleaner.org/en/misc/w00tw00t.html

这是另一个关于它的stackoverflow问题,
- iptable rule to drop packet with a specific substring in payload

希望有帮助!

于 2013-10-24T20:51:32.637 回答
0

提供的解决方案对我不起作用。这是做了什么:

iptables -A INPUT -p tcp -m string --string "/path/to/file.php" --algo kmp -j REJECT
于 2019-06-12T22:39:18.620 回答