aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorLionel <lionel.prat9@gmail.com>2020-10-06 18:51:10 +0200
committerGitHub <noreply@github.com>2020-10-06 18:51:10 +0200
commitb51bc0faa581c293832433904ee499086dbf47d7 (patch)
tree7c98cfbdf79a043f3208aa6244fe83cec03b6bdf /rules
parent11d962e46a919a0ff78cc4b7d168825991f0e400 (diff)
downloadrspamd-b51bc0faa581c293832433904ee499086dbf47d7.tar.gz
rspamd-b51bc0faa581c293832433904ee499086dbf47d7.zip
Add MID check TLD domain
Diffstat (limited to 'rules')
-rw-r--r--rules/mid.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/rules/mid.lua b/rules/mid.lua
index b74ff13df..68a15136c 100644
--- a/rules/mid.lua
+++ b/rules/mid.lua
@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
-
+local util = require "rspamd_util"
local function mid_check_func(task)
local mid = task:get_header('Message-ID')
if not mid then return false end
@@ -42,10 +42,19 @@ local function mid_check_func(task)
local _,_,md = mid:find("@([^>]+)>?$")
-- See if all or part of the From address
-- can be found in the Message-ID
+ -- extract tld
+ local fdtld = nil
+ local mdtld = nil
+ if md then
+ fdtld = util.get_tld(fd)
+ mdtld = util.get_tld(md)
+ end
if (mid:lower():find(from[1].addr:lower(),1,true)) then
task:insert_result('MID_CONTAINS_FROM', 1.0)
elseif (md and fd == md:lower()) then
task:insert_result('MID_RHS_MATCH_FROM', 1.0)
+ elseif (md and mdtld:lower() == fdtld) then
+ task:insert_result('MID_RHS_MATCH_FROMTLD', 1.0)
end
end
-- Check To address attributes against MID
@@ -88,6 +97,9 @@ rspamd_config:set_metric_symbol('MID_CONTAINS_FROM', 1.0, 'Message-ID contains F
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_RHS_MATCH_FROMTLD', 1.0, check_mid_id)
+rspamd_config:set_metric_symbol('MID_RHS_MATCH_FROMTLD', 0.0,
+ 'Message-ID RHS matches From domain tld', '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)