我试图了解发生了什么。如果我将单个 IP 添加到我的黑名单中
Require not ip xxx.xxx.xxx.xxx
它只是有效,Apache 2.4 抛出 403。现在我已经尝试使用整个范围,但它仍然让请求通过。我用了:
Require not ip xxx.xxx.xxx.1 xxx.xxx.xxx.255
Apache 2.4 返回 200 而不是 403。我做错了什么?
谢谢
编辑 :
这是我本地网络的一个简单测试用例。
Require not ip 192.168.1.180/192.168.1.185
在 ip 192.168.1.183 上使用计算机,并且根本没有被阻止。
这是我的 httpd.conf,ips 在一个单独的 blacklist.txt 中。它也适用于单个 ip,问题仅与 有关。范围的 IP。
<Directory "f:/root">
Options Indexes FollowSymLinks
AllowOverride All
<LimitExcept GET POST HEAD>
</LimitExcept>
<RequireAll>
Require all granted
Include conf/blacklist.txt
</RequireAll>
</Directory>
编辑 2 :
做了另一个测试,似乎问题来自于使用 黑名单+GEOIP .黑名单单独与 xxx.xxx.xxx.0/xxx.xxx.xxx.255 一起使用,但一旦 mod_geoip 处于事件状态,黑名单将被忽略。
这是我的 GEOIP 配置:
<IfModule geoip_module>
GeoIPEnable On
GeoIPEnableUTF8 On
GeoIPOutput Env
GeoIPScanProxyHeaders On
GeoIPDBFile bin/GeoIP.dat MemoryCache
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
</IfModule>
如果有办法拥有黑名单和GEOIP 合作??
最佳答案
您的 IP 范围格式错误。它应该如下所述。
Require not ip xxx.xxx.xxx.1/xxx.xxx.xxx.255
关于Apache 2.4 不要求 ip 范围不起作用(GEOIP 事件时忽略黑名单),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25276188/