diff --git a/plugins/op_waf/install.sh b/plugins/op_waf/install.sh index 8047ab582..1a97d3e65 100755 --- a/plugins/op_waf/install.sh +++ b/plugins/op_waf/install.sh @@ -2,7 +2,7 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -# cd /www/server/mdserver-web/plugins/op_waf && bash install.sh install 0.3.0 +# cd /www/server/mdserver-web/plugins/op_waf && bash install.sh install 0.3.2 curPath=`pwd` rootPath=$(dirname "$curPath") diff --git a/plugins/op_waf/waf/lua/init.lua b/plugins/op_waf/waf/lua/init.lua index bc922c3f4..e55e879de 100644 --- a/plugins/op_waf/waf/lua/init.lua +++ b/plugins/op_waf/waf/lua/init.lua @@ -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