load inline multisite values for white/black/grey list core

This commit is contained in:
florian 2023-04-24 14:24:00 +02:00
parent c2e0e51067
commit 5f9f1e54f8
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
4 changed files with 44 additions and 2 deletions

4
TODO
View File

@ -1,5 +1,5 @@
- load inline values for white/black/grey list core
- bwcli with redis
- direct access to ANTIBOT_URI without prepare_challenge call
- don't fail if session err is not nil (new session will be created)
- limit refactoring with redis scripts if needed
- stream refactoring
- stream examples

View File

@ -25,6 +25,23 @@ function blacklist:initialize()
else
self.lists = cjson.decode(lists)
end
local kinds = {
["IP"] = {},
["RDNS"] = {},
["ASN"] = {},
["USER_AGENT"] = {},
["URI"] = {},
["IGNORE_IP"] = {},
["IGNORE_RDNS"] = {},
["IGNORE_ASN"] = {},
["IGNORE_USER_AGENT"] = {},
["IGNORE_URI"] = {},
}
for kind, _ in pairs(kinds) do
for data in self.variables["BLACKLIST_" .. kind]:gmatch("%S+") do
table.insert(self.lists[kind], data)
end
end
end
-- Instantiate cachestore
self.cachestore = cachestore:new(self.use_redis)

View File

@ -24,6 +24,18 @@ function greylist:initialize()
else
self.lists = cjson.decode(lists)
end
local kinds = {
["IP"] = {},
["RDNS"] = {},
["ASN"] = {},
["USER_AGENT"] = {},
["URI"] = {}
}
for kind, _ in pairs(kinds) do
for data in self.variables["GREYLIST_" .. kind]:gmatch("%S+") do
table.insert(self.lists[kind], data)
end
end
end
-- Instantiate cachestore
self.cachestore = cachestore:new(self.use_redis)

View File

@ -26,6 +26,19 @@ function whitelist:initialize()
else
self.lists = cjson.decode(lists)
end
local kinds = {
["IP"] = {},
["RDNS"] = {},
["ASN"] = {},
["USER_AGENT"] = {},
["URI"] = {}
}
for kind, _ in pairs(kinds) do
for data in self.variables["WHITELIST_" .. kind]:gmatch("%S+") do
self.logger:log(ngx.ERR, data)
table.insert(self.lists[kind], data)
end
end
end
-- Instantiate cachestore
self.cachestore = cachestore:new(self.use_redis and ngx.get_phase() == "access")