From: Jan Smutny Date: Sat, 18 Apr 2020 22:20:32 +0000 (+0200) Subject: rules/headers_checks.lua: add [ENV]FROM_INVALID X-Git-Tag: 2.6~486^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=17955398297ab00f27aaa4f9f5efba7be096dbb5;p=rspamd.git rules/headers_checks.lua: add [ENV]FROM_INVALID --- diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua index 9ceb60188..6c5489822 100644 --- a/rules/headers_checks.lua +++ b/rules/headers_checks.lua @@ -626,7 +626,13 @@ local check_from_id = rspamd_config:register_symbol{ callback = function(task) local envfrom = task:get_from(1) local from = task:get_from(2) + if (envfrom and envfrom[1] and not envfrom[1]["flags"]["valid"]) then + task:insert_result('ENVFROM_INVALID', 1.0) + end if (from and from[1]) then + if not (from[1]["flags"]["valid"]) then + task:insert_result('FROM_INVALID', 1.0) + end if (from[1].name == nil or from[1].name == '' ) then task:insert_result('FROM_NO_DN', 1.0) elseif (from[1].name and @@ -672,6 +678,22 @@ local check_from_id = rspamd_config:register_symbol{ end } +rspamd_config:register_symbol{ + name = 'ENVFROM_INVALID', + score = 2.0, + group = 'headers', + parent = check_from_id, + type = 'virtual', + description = 'Envelope from does not have a valid format', +} +rspamd_config:register_symbol{ + name = 'FROM_INVALID', + score = 2.0, + group = 'headers', + parent = check_from_id, + type = 'virtual', + description = 'From header does not have a valid format', +} rspamd_config:register_symbol{ name = 'FROM_NO_DN', score = 0.0,