|
|
|
@ -555,8 +555,6 @@ end |
|
|
|
|
|
|
|
|
|
local geo=nil |
|
|
|
|
local waf_country="" |
|
|
|
|
local geo2=nil |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function initmaxminddb() |
|
|
|
|
if geo==nil then |
|
|
|
@ -594,8 +592,9 @@ end |
|
|
|
|
|
|
|
|
|
local function get_country() |
|
|
|
|
local ip = params['ip'] |
|
|
|
|
if ngx.shared.waf_limit:get("get_country"..ip) then |
|
|
|
|
return ngx.shared.waf_limit:get("get_country"..ip) |
|
|
|
|
local ip_local = ngx.shared.waf_limit:get("get_country"..ip) |
|
|
|
|
if ip_local then |
|
|
|
|
return ip_local |
|
|
|
|
end |
|
|
|
|
local ip_postion=get_ip_country(ip) |
|
|
|
|
if ip_postion=="2" then return false end |
|
|
|
@ -662,8 +661,10 @@ function run_app_waf() |
|
|
|
|
-- C:D("min_route") |
|
|
|
|
-- country limit |
|
|
|
|
local waf_country = get_country() |
|
|
|
|
if area_limit(waf_country, server_name, site_config[server_name]['open']) then return true end |
|
|
|
|
|
|
|
|
|
if waf_country then |
|
|
|
|
if area_limit(waf_country, server_name, site_config[server_name]['open']) then return true end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if site_config[server_name] and site_config[server_name]['open'] then |
|
|
|
|
|
|
|
|
|
|
|
|
|
|