Update init.lua
parent
b89d6ea755
commit
b32ae8f728
24
init.lua
24
init.lua
|
@ -15,6 +15,8 @@ PathInfoFix = optionIsOn(PathInfoFix)
|
||||||
attacklog = optionIsOn(attacklog)
|
attacklog = optionIsOn(attacklog)
|
||||||
CCDeny = optionIsOn(CCDeny)
|
CCDeny = optionIsOn(CCDeny)
|
||||||
Redirect=optionIsOn(Redirect)
|
Redirect=optionIsOn(Redirect)
|
||||||
|
|
||||||
|
|
||||||
function getClientIp()
|
function getClientIp()
|
||||||
IP = ngx.req.get_headers()["X-Real-IP"]
|
IP = ngx.req.get_headers()["X-Real-IP"]
|
||||||
if IP == nil then
|
if IP == nil then
|
||||||
|
@ -65,10 +67,14 @@ urlrules=read_rule('url')
|
||||||
argsrules=read_rule('args')
|
argsrules=read_rule('args')
|
||||||
uarules=read_rule('user-agent')
|
uarules=read_rule('user-agent')
|
||||||
wturlrules=read_rule('whiteurl')
|
wturlrules=read_rule('whiteurl')
|
||||||
|
white_servername_list = read_rule('white_servername')
|
||||||
postrules=read_rule('post')
|
postrules=read_rule('post')
|
||||||
ckrules=read_rule('cookie')
|
ckrules=read_rule('cookie')
|
||||||
white_servername = read_rule('white_servername')
|
|
||||||
|
|
||||||
|
function debug(info)
|
||||||
|
write("/var/log/nginx/waf/debug.log", info)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function say_html()
|
function say_html()
|
||||||
if Redirect then
|
if Redirect then
|
||||||
|
@ -93,22 +99,28 @@ function whiteurl()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function white_servername()
|
function white_servername()
|
||||||
if WhiteServerName then:
|
debug("white servername")
|
||||||
|
if 1==1 then
|
||||||
host = ngx.req.get_headers()["Host"]
|
host = ngx.req.get_headers()["Host"]
|
||||||
if host == nil then
|
if host == nil then
|
||||||
|
debug("nil host")
|
||||||
return false;
|
return false;
|
||||||
if white_servername ~= nil then
|
end
|
||||||
for _, rule in pairs(white_servername) do
|
debug(host)
|
||||||
|
if white_servername_list ~= nil then
|
||||||
|
for _, rule in pairs(white_servername_list) do
|
||||||
if ngxmatch(host, rule, "isjo") then
|
if ngxmatch(host, rule, "isjo") then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function fileExtCheck(ext)
|
function fileExtCheck(ext)
|
||||||
local items = Set(black_fileExt)
|
local items = Set(black_fileExt)
|
||||||
ext=string.lower(ext)
|
ext=string.lower(ext)
|
||||||
|
|
Loading…
Reference in New Issue