commit b8cab48: [Minor] Rbl: Allow to exclude certain checks to simplify local.d additions
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Feb 26 13:42:07 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-02-26 13:36:04 +0000
URL: https://github.com/rspamd/rspamd/commit/b8cab482167dfa41400671502bd66fe6e3ec0d05
[Minor] Rbl: Allow to exclude certain checks to simplify local.d additions
Issue: #3655
---
lualib/plugins/rbl.lua | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua
index 3bddf52ba..f3a2035d3 100644
--- a/lualib/plugins/rbl.lua
+++ b/lualib/plugins/rbl.lua
@@ -138,32 +138,39 @@ local rule_schema_tbl = {
ts.array_of(ts.string) + (ts.string / function(s) return {s} end)
):is_optional(),
checks = ts.array_of(ts.one_of(lua_util.keys(check_types))):is_optional(),
+ exclude_checks = ts.array_of(ts.one_of(lua_util.keys(check_types))):is_optional(),
}
local function convert_checks(rule)
local rspamd_logger = require "rspamd_logger"
if rule.checks then
local all_connfilter = true
+ local exclude_checks = lua_util.list_to_hash(rule.exclude_checks or {})
for _,check in ipairs(rule.checks) do
- local check_type = check_types[check]
- if check_type.require_argument then
- if not rule[check] then
- rspamd_logger.errx(rspamd_config, 'rbl rule %s has check %s which requires an argument',
- rule.symbol, check)
- return nil
+ if not exclude_checks[check] then
+ local check_type = check_types[check]
+ if check_type.require_argument then
+ if not rule[check] then
+ rspamd_logger.errx(rspamd_config, 'rbl rule %s has check %s which requires an argument',
+ rule.symbol, check)
+ return nil
+ end
end
- end
- rule[check] = check_type
+ rule[check] = check_type
- if not check_type.connfilter then
- all_connfilter = false
- end
+ if not check_type.connfilter then
+ all_connfilter = false
+ end
- if not check_type then
- rspamd_logger.errx(rspamd_config, 'rbl rule %s has invalid check type: %s',
- rule.symbol, check)
- return nil
+ if not check_type then
+ rspamd_logger.errx(rspamd_config, 'rbl rule %s has invalid check type: %s',
+ rule.symbol, check)
+ return nil
+ end
+ else
+ rspamd_logger.infox(rspamd_config, 'disable check %s in %s: excluded explicitly',
+ check, rule.symbol)
end
end
rule.connfilter = all_connfilter
More information about the Commits
mailing list