Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add whit host support #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ Redirect="on"
CookieMatch="on"
postMatch="on"
whiteModule="on"
whiteHostModule="on"
black_fileExt={"php","jsp"}
ipWhitelist={"127.0.0.1"}
ipBlocklist={"1.0.0.1"}
hostWhiteList = {"www.xxx.com"}
CCDeny="off"
CCrate="100/60"
html=[[
Expand Down
14 changes: 14 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ UrlDeny = optionIsOn(UrlDeny)
PostCheck = optionIsOn(postMatch)
CookieCheck = optionIsOn(cookieMatch)
WhiteCheck = optionIsOn(whiteModule)
WhiteHostCheck = optionIsOn(whiteHostModule)
PathInfoFix = optionIsOn(PathInfoFix)
attacklog = optionIsOn(attacklog)
CCDeny = optionIsOn(CCDeny)
Expand Down Expand Up @@ -89,6 +90,19 @@ function whiteurl()
end
return false
end

function whitehost()
if WhiteHostCheck then
local items = Set(hostWhiteList)
for host in pairs(items) do
if ngxmatch(ngx.var.host, host, "isjo") then
return true
end
end
end
return false
end

function fileExtCheck(ext)
local items = Set(black_fileExt)
ext=string.lower(ext)
Expand Down
1 change: 1 addition & 0 deletions waf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local content_length=tonumber(ngx.req.get_headers()['content-length'])
local method=ngx.req.get_method()
local ngxmatch=ngx.re.match
if whiteip() then
elseif whitehost() then
elseif blockip() then
elseif denycc() then
elseif ngx.var.http_Acunetix_Aspect then
Expand Down