mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
whitelist - fix missing check for empty server_name in multisite mode
This commit is contained in:
parent
ab949bf710
commit
252c16b763
1 changed files with 10 additions and 9 deletions
|
|
@ -15,7 +15,6 @@ set_by_lua_block $whitelist_default {
|
|||
local datastore = cdatastore:new()
|
||||
local logger = clogger:new("WHITELIST-DEFAULT")
|
||||
|
||||
|
||||
local checks = {
|
||||
["IP"] = "ip" .. ngx_var.remote_addr,
|
||||
}
|
||||
|
|
@ -60,14 +59,16 @@ set_by_lua_block $whitelist_default {
|
|||
for server_name, server_vars in pairs(variables) do
|
||||
local domains = server_vars["SERVER_NAME"]
|
||||
local domain = domains:gmatch("%S+")()
|
||||
for k, v in pairs(checks) do
|
||||
local ok, data = cachestore:get("plugin_whitelist_" .. domain .. v)
|
||||
if not ok and data then
|
||||
logger:log(ERR, "error while checking cachestore : " .. data)
|
||||
elseif ok and data ~= nil and data ~= "ok" then
|
||||
logger:log(NOTICE, "whitelisting on default server (original server = " .. domain .. " and data = " .. data .. ")")
|
||||
ngx_var.is_whitelisted = "yes"
|
||||
return "ok"
|
||||
if domain then
|
||||
for k, v in pairs(checks) do
|
||||
local ok, data = cachestore:get("plugin_whitelist_" .. domain .. v)
|
||||
if not ok and data then
|
||||
logger:log(ERR, "error while checking cachestore : " .. data)
|
||||
elseif ok and data ~= nil and data ~= "ok" then
|
||||
logger:log(NOTICE, "whitelisting on default server (original server = " .. domain .. " and data = " .. data .. ")")
|
||||
ngx_var.is_whitelisted = "yes"
|
||||
return "ok"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue