[GH-ISSUE #59] IP 黑名单似乎不支持 0.0.0.0/0 ? #39

Closed
opened 2026-03-04 12:18:16 +03:00 by kerem · 2 comments
Owner

Originally created by @LodeSNA on GitHub (Aug 10, 2021).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/59

版本为最新的 ngx_waf v7.0.0 Current,Nginx 版本为 1.20.1,预编译的动态模块(sh assets/download.sh 1.20.1 current)

测试环境配置好 Nginx 之后,在 ipv4 写上 0.0.0.0/0,在 white-ipv4 写上本机 IP 如 192.168.1.100,实际效果是黑名单没有生效,其它 IP 的机器都可以访问得到网站。

将某个 IP 如 192.168.1.101 加入到黑名单后,在 192.168.1.101 这台机器上是无法访问到网站的,证明黑名单已生效。

其实就是想知道,是否支持纯白名单模式。

Originally created by @LodeSNA on GitHub (Aug 10, 2021). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/59 版本为最新的 ngx_waf v7.0.0 Current,Nginx 版本为 1.20.1,预编译的动态模块(sh assets/download.sh 1.20.1 current) 测试环境配置好 Nginx 之后,在 ipv4 写上 0.0.0.0/0,在 white-ipv4 写上本机 IP 如 192.168.1.100,实际效果是黑名单没有生效,其它 IP 的机器都可以访问得到网站。 将某个 IP 如 192.168.1.101 加入到黑名单后,在 192.168.1.101 这台机器上是无法访问到网站的,证明黑名单已生效。 其实就是想知道,是否支持纯白名单模式。
kerem 2026-03-04 12:18:16 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ADD-SP commented on GitHub (Aug 10, 2021):

感谢您报告了这个 bug,我们开发时确实没有考虑到形如 w.x.y.z/0 这样的 IP 地址。修复补丁已经上传到 current-dev 分支,您可以下载测试。

如果 bug 被修复请您关闭本 issue,反之请告知。

说句题外话,如果仅仅只需要 IP 白名单这一个功能的话似乎不需要本模块,nginx 的官方模块 ngx_http_access_module 就可以实现,详见 https://nginx.org/en/docs/http/ngx_http_access_module.html#allow

server {
    deny  192.168.1.1;
    allow 192.168.1.0/24;
    allow 10.1.1.0/16;
    allow 2001:0db8::/32;
    deny  all;
}
<!-- gh-comment-id:896069200 --> @ADD-SP commented on GitHub (Aug 10, 2021): 感谢您报告了这个 bug,我们开发时确实没有考虑到形如 `w.x.y.z/0` 这样的 IP 地址。修复补丁已经上传到 `current-dev` 分支,您可以下载测试。 如果 bug 被修复请您关闭本 issue,反之请告知。 说句题外话,如果仅仅只需要 IP 白名单这一个功能的话似乎不需要本模块,nginx 的官方模块 `ngx_http_access_module` 就可以实现,详见 https://nginx.org/en/docs/http/ngx_http_access_module.html#allow 。 ```nginx server { deny 192.168.1.1; allow 192.168.1.0/24; allow 10.1.1.0/16; allow 2001:0db8::/32; deny all; } ```
Author
Owner

@LodeSNA commented on GitHub (Aug 11, 2021):

已修复。

<!-- gh-comment-id:896520235 --> @LodeSNA commented on GitHub (Aug 11, 2021): 已修复。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ngx_waf#39
No description provided.