I'm trying to understand what's going on. If i add a single IP to my blacklist using
Require not ip xxx.xxx.xxx.xxx
It just works, Apache 2.4 throws a 403. Now i've tried to use the whole range and it still let the request go through. I used:
Require not ip xxx.xxx.xxx.1 xxx.xxx.xxx.255
Apache 2.4 returns 200 instead of 403. What am i doing wrong?
Thanks
Edit: Here's a simple test case from my local network.
Require not ip 192.168.1.180/192.168.1.185
Used computer on ip 192.168.1.183, and wasn't blocked at all.
Here's my httpd.conf and the ips are in a seperate blacklist.txt. Also it works with a single ip, the issue is only related to a RANGE of IPs.
<Directory "f:/root">
Options Indexes FollowSymLinks
AllowOverride All
<LimitExcept GET POST HEAD>
</LimitExcept>
<RequireAll>
Require all granted
Include conf/blacklist.txt
</RequireAll>
</Directory>
Edit2: Did another test and it seems that the issue comes from using a blacklist + GEOIP. Blacklist alone works with xxx.xxx.xxx.0/xxx.xxx.xxx.255 but as soon as mod_geoip is active, the blacklist is ignored.
Here is my GEOIP config:
<IfModule geoip_module>
GeoIPEnable On
GeoIPEnableUTF8 On
GeoIPOutput Env
GeoIPScanProxyHeaders On
GeoIPDBFile bin/GeoIP.dat MemoryCache
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
</IfModule>
If there a way to have BOTH blacklist and GEOIP working together??
Your IP range format is wrong. It should be as mentioned below.
Require not ip xxx.xxx.xxx.1/xxx.xxx.xxx.255