aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorJan Smutny <js@excello.cz>2020-04-19 00:20:32 +0200
committerJan Smutny <js@excello.cz>2020-04-19 00:22:14 +0200
commit17955398297ab00f27aaa4f9f5efba7be096dbb5 (patch)
treea80d4990871f334c4be8d05646ae61020943299f /rules
parent23675060063301aaa3c93044e0029fda553d4e8f (diff)
downloadrspamd-17955398297ab00f27aaa4f9f5efba7be096dbb5.tar.gz
rspamd-17955398297ab00f27aaa4f9f5efba7be096dbb5.zip
rules/headers_checks.lua: add [ENV]FROM_INVALID
Diffstat (limited to 'rules')
-rw-r--r--rules/headers_checks.lua22
1 files changed, 22 insertions, 0 deletions
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
@@ -673,6 +679,22 @@ local check_from_id = rspamd_config:register_symbol{
}
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,
group = 'headers',