diff --git a/rules/anti-cc.lua b/rules/anti-cc.lua index 502416b..3ee10c6 100644 --- a/rules/anti-cc.lua +++ b/rules/anti-cc.lua @@ -17,14 +17,15 @@ local sh = ngx.shared.ipCache local ccIp = 'cc-' .. waf.ip local c, f = sh:get(ccIp) if not c then - sh:set(ccIp, 0, 60, 1) -- 设置1分钟也就是60秒访问计数时间 + sh:set(ccIp, 1, 60, 1) -- 设置1分钟也就是60秒访问计数时间 else if f == 2 then - return waf.block(true) + return waf.block(true) -- 重置TCP连接,不记录日志 end sh:incr(ccIp, 1) - if c >= 360 then - sh:set(ccIp, c, 300, 2) -- 设置5分钟也就是300秒拦截时间 + if c + 1 >= 360 then + sh:set(ccIp, c + 1, 300, 2) -- 设置5分钟也就是300秒拦截时间 + return true, ccIp, true end end