...
|
...
|
@@ -178,11 +178,19 @@ local subscribe_mal_ips=function() |
|
|
if res[3] then
|
|
|
local t=cjson.decode(res[3])
|
|
|
local ips=t.ips
|
|
|
local expire=(not t.expire) and 86400 or t.expire
|
|
|
local expire=(not t.expire) and 43200 or t.expire
|
|
|
if t.type == "add" then
|
|
|
for ip in string.gmatch(ips,"[^',']+") do
|
|
|
cache:set("yh:mip:" .. ip,"1",expire)
|
|
|
ngx.log(ngx.INFO,"nginx subscribe mal ip:" .. tostring(ip) .. ":" .. tostring(expire))
|
|
|
ngx.log(ngx.INFO,"nginx subscribe add mal ip:" .. tostring(ip) .. ":" .. tostring(expire))
|
|
|
end
|
|
|
elseif t.type == "del" then
|
|
|
for ip in string.gmatch(ips,"[^',']+") do
|
|
|
cache:delete("yh:mip:" .. ip)
|
|
|
ngx.log(ngx.INFO,"nginx subscribe del mal ip:" .. tostring(ip) .. ":" .. tostring(expire))
|
|
|
end
|
|
|
end
|
|
|
|
|
|
end
|
|
|
elseif err ~= "timeout" then
|
|
|
connect:close()
|
...
|
...
|
@@ -260,6 +268,7 @@ function limit_ip_access_conf_to_worker() |
|
|
if t then
|
|
|
local r=cjson.decode(t)
|
|
|
if r then
|
|
|
r["white_method"]={"app.graphic.img","app.graphic.verify"}
|
|
|
lua_context.configs["limit_ip_access"]=r
|
|
|
--ngx.log(ngx.INFO,"++++++++++++++" .. cjson.encode(lua_context.configs["limit_ip_access"]))
|
|
|
end
|
...
|
...
|
|