From c10ccf24fa2382cd8a594d7a2e9cf6b5e97cb163 Mon Sep 17 00:00:00 2001 From: zhengji Date: Sun, 8 Nov 2015 12:11:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20server=5Fname=20=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95=EF=BC=8C=E7=BB=99=E6=8C=87=E5=AE=9A=E7=9A=84?= =?UTF-8?q?server=5Fname=20=E6=94=BE=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.lua | 1 + init.lua | 12 ++++++++++++ waf.lua | 1 + 3 files changed, 14 insertions(+) diff --git a/config.lua b/config.lua index 6e66ce6..321f8aa 100644 --- a/config.lua +++ b/config.lua @@ -8,6 +8,7 @@ postMatch="on" whiteModule="on" black_fileExt={"php","jsp"} ipWhitelist={"127.0.0.1"} +servernameWhitelist={"www.xx.com"} ipBlocklist={"1.0.0.1"} CCDeny="off" CCrate="100/60" diff --git a/init.lua b/init.lua index eb44bf0..871c491 100644 --- a/init.lua +++ b/init.lua @@ -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 + diff --git a/waf.lua b/waf.lua index bc9821c..b8b9386 100644 --- a/waf.lua +++ b/waf.lua @@ -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)