aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-06-25 12:45:28 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-06-25 12:45:28 +0100
commit0389ba3f00b579fb538c021bd0de39f5e4c0b613 (patch)
tree1b11a1e1c8649322e5eb568d93c031b0fcbc7d9a
parentca46c5ca6bceca5577fff3efe2c936be238f588d (diff)
downloadrspamd-0389ba3f00b579fb538c021bd0de39f5e4c0b613.tar.gz
rspamd-0389ba3f00b579fb538c021bd0de39f5e4c0b613.zip
[Minor] Add some sanity stuff for signing to skip signing for passthrough results
-rw-r--r--lualib/lua_dkim_tools.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/lualib/lua_dkim_tools.lua b/lualib/lua_dkim_tools.lua
index 5552ae861..21794a570 100644
--- a/lualib/lua_dkim_tools.lua
+++ b/lualib/lua_dkim_tools.lua
@@ -156,6 +156,29 @@ local function prepare_dkim_signing(N, task, settings)
is_local = true
end
+ local has_pre_result = task:has_pre_result()
+ if has_pre_result then
+ local metric_action = task:get_metric_action()
+
+ if metric_action == 'reject' or metric_action == 'drop' then
+ -- No need to sign what we are already rejecting/dropping
+ lua_util.debugm(N, task, 'task result is already %s, no need to sign', metric_action)
+ return false,{}
+ end
+
+ if metric_action == 'soft reject' then
+ -- Same here, we are going to delay an email, signing is just a waste of time
+ lua_util.debugm(N, task, 'task result is %s, skip signing', metric_action)
+ return false,{}
+ end
+
+ -- For spam actions, there is no clear distinction
+ if metric_action ~= 'no action' and type(settings.skip_spam_sign) == 'boolean' and settings.skip_spam_sign then
+ lua_util.debugm(N, task, 'task result is %s, no need to sign', metric_action)
+ return false,{}
+ end
+ end
+
if settings.sign_authenticated and auser then
lua_util.debugm(N, task, 'user is authenticated')
is_authed = true