aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorSteve Freegard <steve@stevefreegard.com>2017-07-26 22:55:35 +0100
committerSteve Freegard <steve@stevefreegard.com>2017-07-26 22:55:35 +0100
commita6e691c223d41e301775e3e48d808c5419f24edc (patch)
treeef4f0e35c19107de0d17047bf10600878120d4ab /rules
parent9ac17392b318daee37755fcf2d256dddd7dbbe1a (diff)
downloadrspamd-a6e691c223d41e301775e3e48d808c5419f24edc.tar.gz
rspamd-a6e691c223d41e301775e3e48d808c5419f24edc.zip
Update Message-ID rules with new observed patterns
Diffstat (limited to 'rules')
-rw-r--r--rules/mid.lua26
1 files changed, 24 insertions, 2 deletions
diff --git a/rules/mid.lua b/rules/mid.lua
index 9fd4df555..d89f217da 100644
--- a/rules/mid.lua
+++ b/rules/mid.lua
@@ -1,6 +1,6 @@
--[[
Copyright (c) 2016, Vsevolod Stakhov <vsevolod@highsecure.ru>
-Copyright (c) 2016, Steve Freeguard
+Copyright (c) 2016, Steve Freegard <steve@freegard.name>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -36,8 +36,9 @@ local function mid_check_func(task)
end
-- Check From address attributes against MID
local from = task:get_from(2)
+ local fd
if (from and from[1] and from[1].domain and from[1].domain ~= '') then
- local fd = from[1].domain:lower()
+ fd = from[1].domain:lower()
local _,_,md = mid:find("@([^>]+)>?$")
-- See if all or part of the From address
-- can be found in the Message-ID
@@ -47,6 +48,22 @@ local function mid_check_func(task)
task:insert_result('MID_RHS_MATCH_FROM', 1.0)
end
end
+ -- Check To address attributes against MID
+ local to = task:get_recipients(2)
+ if (to and to[1] and to[1].domain and to[1].domain ~= '') then
+ local td = to[1].domain:lower()
+ local _,_,md = mid:find("@([^>]+)>?$")
+ -- Skip if from domain == to domain
+ if ((fd and fd ~= td) or not fd) then
+ -- See if all or part of the To address
+ -- can be found in the Message-ID
+ if (mid:lower():find(to[1].addr:lower(),1,true)) then
+ task:insert_result('MID_CONTAINS_TO', 1.0)
+ elseif (md and td == md:lower()) then
+ task:insert_result('MID_RHS_MATCH_TO', 1.0)
+ end
+ end
+ end
end
-- MID checks from Steve Freegard
@@ -64,3 +81,8 @@ rspamd_config:register_virtual_symbol('MID_CONTAINS_FROM', 1.0, check_mid_id)
rspamd_config:set_metric_symbol('MID_CONTAINS_FROM', 1.0, 'Message-ID contains From address', 'default', 'Message ID')
rspamd_config:register_virtual_symbol('MID_RHS_MATCH_FROM', 1.0, check_mid_id)
rspamd_config:set_metric_symbol('MID_RHS_MATCH_FROM', 0.0, 'Message-ID RHS matches From domain', 'default', 'Message ID')
+rspamd_config:register_virtual_symbol('MID_CONTAINS_TO', 1.0, check_mid_id)
+rspamd_config:set_metric_symbol('MID_CONTAINS_TO', 1.0, 'Message-ID contains To address', 'default', 'Message ID')
+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')
+