aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authortwesterhever <40121680+twesterhever@users.noreply.github.com>2024-03-24 17:24:24 +0000
committertwesterhever <40121680+twesterhever@users.noreply.github.com>2024-03-24 17:24:24 +0000
commit434f9f79e26583ac93442dbb6c4a33a437acbab3 (patch)
tree7eeb844836836550bf928fed0906c1a1b4683ae2 /rules
parentdb02d917d4a0d853938a02ce56b5c4d914fca50f (diff)
downloadrspamd-434f9f79e26583ac93442dbb6c4a33a437acbab3.tar.gz
rspamd-434f9f79e26583ac93442dbb6c4a33a437acbab3.zip
[Enhancement] Add more symbols for Reply-To header characteristics
Diffstat (limited to 'rules')
-rw-r--r--rules/headers_checks.lua50
1 files changed, 36 insertions, 14 deletions
diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua
index 92ebb0ca3..9a716288b 100644
--- a/rules/headers_checks.lua
+++ b/rules/headers_checks.lua
@@ -233,20 +233,7 @@ local check_replyto_id = rspamd_config:register_symbol({
if (util.strequal_caseless(from[1].domain, rt[1].domain)) then
task:insert_result('REPLYTO_DOM_EQ_FROM_DOM', 1.0)
else
- -- See if Reply-To matches the To address
- local to = task:get_recipients(2)
- if (to and to[1] and to[1].addr:lower() == rt[1].addr:lower()) then
- -- Ignore this for mailing-lists and automatic submissions
- if (not (task:get_header('List-Unsubscribe') or
- task:get_header('X-To-Get-Off-This-List') or
- task:get_header('X-List') or
- task:get_header('Auto-Submitted')))
- then
- task:insert_result('REPLYTO_EQ_TO_ADDR', 1.0)
- end
- else
- task:insert_result('REPLYTO_DOM_NEQ_FROM_DOM', 1.0)
- end
+ task:insert_result('REPLYTO_DOM_NEQ_FROM_DOM', 1.0)
end
end
-- See if the Display Names match
@@ -255,6 +242,25 @@ local check_replyto_id = rspamd_config:register_symbol({
task:insert_result('REPLYTO_DN_EQ_FROM_DN', 1.0)
end
end
+
+ -- See if Reply-To matches the To address
+ local to = task:get_recipients(2)
+ if (to and to[1] and to[1].addr:lower() == rt[1].addr:lower()) then
+ -- Ignore this for mailing-lists and automatic submissions
+ if (not (task:get_header('List-Unsubscribe') or
+ task:get_header('X-To-Get-Off-This-List') or
+ task:get_header('X-List') or
+ task:get_header('Auto-Submitted')))
+ then
+ task:insert_result('REPLYTO_EQ_TO_ADDR', 1.0)
+ end
+ elseif to[1].domain and rt[1].domain then
+ if (util.strequal_caseless(to[1].domain, rt[1].domain)) then
+ task:insert_result('REPLYTO_DOM_EQ_TO_DOM', 1.0)
+ else
+ task:insert_result('REPLYTO_DOM_NEQ_TO_DOM', 1.0)
+ end
+ end
end
end
})
@@ -331,6 +337,22 @@ rspamd_config:register_symbol {
description = 'Reply-To is the same as the To address',
group = 'headers',
}
+rspamd_config:register_symbol {
+ name = 'REPLYTO_DOM_EQ_TO_DOM',
+ score = 0.0,
+ parent = check_replyto_id,
+ type = 'virtual',
+ description = 'Reply-To domain matches the To domain',
+ group = 'headers',
+}
+rspamd_config:register_symbol {
+ name = 'REPLYTO_DOM_NEQ_TO_DOM',
+ score = 0.0,
+ parent = check_replyto_id,
+ type = 'virtual',
+ description = 'Reply-To domain does not match the To domain',
+ group = 'headers',
+}
rspamd_config:register_dependency('CHECK_REPLYTO', 'CHECK_FROM')