Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CnChunfeng
/
ichunt_lua_waf
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3f4300d3
authored
Oct 19, 2020
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加代码
parent
44020065
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
waf.lua
waf.lua
View file @
3f4300d3
...
...
@@ -23,6 +23,7 @@ local cjson = require "cjson"
-------去除一些不要验证的请求并获取url
local
urlok
,
temp_uri
=
reqhandle
.
Selfwhiteurl
()
if
urlok
==
"ok"
then
...
...
@@ -31,8 +32,6 @@ if urlok == "ok" then
end
-------链接redis------------
local
red
=
redis
:
new
()
red
:
set_timeout
(
1000
)
...
...
@@ -93,14 +92,10 @@ if wafcheck.WhiteIp(user_ip) == 'exist' or wafcheck.WhiteUrl(temp_uri) == 'exist
end
-- 黑名单存在直接302
if
wafcheck
.
BlackIp
(
user_ip
)
==
'exist'
or
wafcheck
.
BlackUrl
(
temp_uri
)
==
'exist'
or
wafcheck
.
BlackHeader
(
user_ip
)
==
'exist'
then
return
end
-- 黑名单
is_black
,
err
=
red
:
sismember
(
'spider_black_list'
,
user_ip
)
if
is_black
==
1
then
red
:
close
()
ngx
.
exit
(
ngx
.
HTTP_FORBIDDEN
)
return
...
...
@@ -109,6 +104,7 @@ end
-------s------------------------20200923新增对用户特定URL,IP时间段内的限制-------s------------------------
--[[
1 设置需要的请求网址 redis 集合 waf_urldesc_limit
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment