From 4129ef5132a00d6a0441a3b9fb387120a195fe0c Mon Sep 17 00:00:00 2001 From: Reto Kupferschmid Date: Thu, 23 Dec 2021 22:53:50 +0100 Subject: [PATCH] [Fix] Avoid overwriting whitelisted_signers_map --- lualib/lua_dkim_tools.lua | 2 ++ src/plugins/lua/arc.lua | 30 ++++++++++++------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lualib/lua_dkim_tools.lua b/lualib/lua_dkim_tools.lua index 53a8a8f0f..06ab819f8 100644 --- a/lualib/lua_dkim_tools.lua +++ b/lualib/lua_dkim_tools.lua @@ -705,6 +705,8 @@ exports.process_signing_settings = function(N, settings, opts) else logger.errx(rspamd_config, 'cannot load sign condition %s: %s', v, f) end + elseif k == 'whitelisted_signers_map' then + settings[k] = lua_maps.map_add(N, k, 'set', 'ARC trusted signers domains') else settings[k] = v end diff --git a/src/plugins/lua/arc.lua b/src/plugins/lua/arc.lua index eeff889f4..b73dc89e4 100644 --- a/src/plugins/lua/arc.lua +++ b/src/plugins/lua/arc.lua @@ -413,24 +413,6 @@ rspamd_config:register_symbol({ groups = {'arc'}, }) -if settings.whitelisted_signers_map then - local lua_maps = require "lua_maps" - settings.whitelisted_signers_map = lua_maps.map_add_from_ucl(settings.whitelisted_signers_map, - 'set', - 'ARC trusted signers domains') - if settings.whitelisted_signers_map then - arc_symbols.trusted_allow = arc_symbols.trusted_allow or 'ARC_ALLOW_TRUSTED' - rspamd_config:register_symbol({ - name = arc_symbols.trusted_allow, - parent = id, - type = 'virtual', - score = -2.0, - group = 'policies', - groups = {'arc'}, - }) - end -end - rspamd_config:register_dependency('ARC_CALLBACK', 'SPF_CHECK') rspamd_config:register_dependency('ARC_CALLBACK', 'DKIM_CHECK') @@ -741,6 +723,18 @@ if type(settings.forbidden_ids) == 'table' then sym_reg_tbl.forbidden_ids = settings.forbidden_ids end +if settings.whitelisted_signers_map then + arc_symbols.trusted_allow = arc_symbols.trusted_allow or 'ARC_ALLOW_TRUSTED' + rspamd_config:register_symbol({ + name = arc_symbols.trusted_allow, + parent = id, + type = 'virtual', + score = -2.0, + group = 'policies', + groups = {'arc'}, + }) +end + rspamd_config:register_symbol(sym_reg_tbl) -- Do not sign unless checked -- 2.39.5