commit 0389ba3: [Minor] Add some sanity stuff for signing to skip signing for passthrough results
Vsevolod Stakhov
vsevolod at rspamd.com
Sat Jun 25 11:49:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-06-25 12:45:28 +0100
URL: https://github.com/rspamd/rspamd/commit/0389ba3f00b579fb538c021bd0de39f5e4c0b613 (HEAD -> master)
[Minor] Add some sanity stuff for signing to skip signing for passthrough results
---
lualib/lua_dkim_tools.lua | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
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
More information about the Commits
mailing list