添加server_name 白名单功能

pull/70/head
zhengji 2015-11-08 12:01:26 +08:00
parent c7ce9b7f02
commit bbc0863fe6
4 changed files with 152 additions and 138 deletions

View File

@ -8,6 +8,7 @@ postMatch="on"
whiteModule="on"
black_fileExt={"php","jsp"}
ipWhitelist={"127.0.0.1"}
servernameWhitelist={"www.baidu.com"}
ipBlocklist={"1.0.0.1"}
CCDeny="off"
CCrate="100/60"

View File

@ -241,3 +241,15 @@ function blockip()
end
return false
end
function whiteSvrName()
if next(servernameWhitelist) ~= nil then
for _,svrname in pairs(servernameWhitelist) do
if ngx.var.server_name == svrname then
return true
end
end
end
return false
end

View File

@ -3,6 +3,7 @@ local method=ngx.req.get_method()
local ngxmatch=ngx.re.match
if whiteip() then
elseif blockip() then
elseif whiteSvrName() then
elseif denycc() then
elseif ngx.var.http_Acunetix_Aspect then
ngx.exit(444)