From 2d2526bc5ce1dfc75276df43a63e2068ffb4901b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Tue, 13 Feb 2024 14:34:50 +0100 Subject: [PATCH] [#922] Add whitelist check for the default-server as well and fix badbehavior whitelist check --- src/common/core/badbehavior/badbehavior.lua | 2 +- src/common/core/order.json | 9 ++++++++- src/common/core/whitelist/whitelist.lua | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/core/badbehavior/badbehavior.lua b/src/common/core/badbehavior/badbehavior.lua index dacd77051..ea6220551 100644 --- a/src/common/core/badbehavior/badbehavior.lua +++ b/src/common/core/badbehavior/badbehavior.lua @@ -21,7 +21,7 @@ end function badbehavior:log() -- Check if we are whitelisted - if is_whitelisted(self.ctx) == "yes" then + if is_whitelisted(self.ctx) then return self:ret(true, "client is whitelisted") end -- Check if bad behavior is activated diff --git a/src/common/core/order.json b/src/common/core/order.json index cbcfeb2e0..30b79a494 100644 --- a/src/common/core/order.json +++ b/src/common/core/order.json @@ -42,6 +42,13 @@ "reversescan" ], "log_stream": ["badbehavior", "bunkernet"], - "log_default": ["badbehavior", "bunkernet", "errors", "misc", "metrics"], + "log_default": [ + "whitelist", + "badbehavior", + "bunkernet", + "errors", + "misc", + "metrics" + ], "timer": ["metrics"] } diff --git a/src/common/core/whitelist/whitelist.lua b/src/common/core/whitelist/whitelist.lua index 880c27de0..3e316d69f 100644 --- a/src/common/core/whitelist/whitelist.lua +++ b/src/common/core/whitelist/whitelist.lua @@ -170,6 +170,10 @@ function whitelist:preread() return self:access() end +function whitelist:log_default() + return self:access() +end + function whitelist:kind_to_ele(kind) if kind == "IP" then return "ip" .. self.ctx.bw.remote_addr