Apache 2.4 不要求 ip 范围不起作用(GEOIP 事件时忽略黑名单)

标签 apache apache2 geoip

我试图了解发生了什么。如果我将单个 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/

相关文章:

php - ubuntu 20.04 apache2 - php 文件下载

django - 强制 django_compressor 重新编译 css/less 文件

php - geoip_country_name_by_name() : Required database not available at C:/xampp/apache/bin/GeoIP. dat

eclipse - 在 Eclipse 中安装 Apache common lang 2.5

mysql - 崩溃后 xampp 文件夹在新硬盘/Windows 上重用

apache - 无法访问 webdav 文件夹中的符号链接(symbolic link) [使用 apache 2.2.22] 或资源管理器 [windows] 的映射驱动器

apache2 - 更改 Apache2 ports.conf 以便 localhost 接口(interface)监听 80 端口

apache - 为什么 Apache 忽略 :80 vhost file and only matching sites in :443 vhost file?

php - 共享主机上的 GeoIP

linux - gentoo geoip安装