summaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-12-23 20:35:52 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-12-23 20:35:52 +0000
commit038ed3f0127b8e6c9134191424869f6ec6081569 (patch)
tree3c02e0c4149d990bc097f2358714ceb10ce74af5 /rules
parentf847a98c8e085d82be09de880b727ffcf7f6a207 (diff)
downloadrspamd-038ed3f0127b8e6c9134191424869f6ec6081569.tar.gz
rspamd-038ed3f0127b8e6c9134191424869f6ec6081569.zip
[Rules] Mid: Add MID_END_EQ_FROM_USER_PART rule
Issue: #4299
Diffstat (limited to 'rules')
-rw-r--r--rules/mid.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/rules/mid.lua b/rules/mid.lua
index 0d3e52c24..2076debb0 100644
--- a/rules/mid.lua
+++ b/rules/mid.lua
@@ -105,3 +105,24 @@ rspamd_config:set_metric_symbol('MID_CONTAINS_TO', 1.0, 'Message-ID contains To
rspamd_config:register_virtual_symbol('MID_RHS_MATCH_TO', 1.0, check_mid_id)
rspamd_config:set_metric_symbol('MID_RHS_MATCH_TO', 1.0, 'Message-ID RHS matches To domain', 'default', 'Message ID')
+-- Another check from https://github.com/rspamd/rspamd/issues/4299
+rspamd_config:register_symbol {
+ type = 'normal,mime',
+ group = 'mid',
+ name = 'MID_END_EQ_FROM_USER_PART',
+ description = 'Message-ID RHS (after @) and MIME from local part are the same',
+ score = 4.0,
+
+ callback = function(task)
+ local mid = task:get_header('Message-ID')
+ if not mid then return end
+ local mime_from = task:get_from('mime')
+ local _,_,mid_realm = mid:find("@([a-z]+)>?$")
+ if mid_realm and mime_from and mime_from[1] and mime_from[1].user then
+ if (mid_realm == mime_from[1].user) then
+ return true
+ end
+ end
+ end
+}
+