diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-02-13 15:25:44 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-02-13 15:25:44 +0200 |
commit | 9369163b3ff393da1ebd28908a47aad483ea3b0a (patch) | |
tree | 02b267963a129e90dfbe35db88e4ada0c4d81287 /rules/misc.lua | |
parent | d4cdf447b822835ee16947f88d88b9b7231d7995 (diff) | |
download | rspamd-9369163b3ff393da1ebd28908a47aad483ea3b0a.tar.gz rspamd-9369163b3ff393da1ebd28908a47aad483ea3b0a.zip |
[Feature] Add REPLYTO_EMAIL_HAS_TITLE rule
Diffstat (limited to 'rules/misc.lua')
-rw-r--r-- | rules/misc.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/rules/misc.lua b/rules/misc.lua index 2685e3826..df9377101 100644 --- a/rules/misc.lua +++ b/rules/misc.lua @@ -16,6 +16,7 @@ limitations under the License. -- This is main lua config file for rspamd +local E = {} local util = require "rspamd_util" local rspamd_regexp = require "rspamd_regexp" @@ -628,6 +629,18 @@ local check_replyto_id = rspamd_config:register_callback_symbol('CHECK_REPLYTO', return false else task:insert_result('HAS_REPLYTO', 1.0) + local rta = rt[1].addr + if rta then + -- Check if Reply-To address starts with title seen in display name + local sym = task:get_symbol('FROM_NAME_HAS_TITLE') + local title = (((sym or E)[1] or E).options or E)[1] + if title then + rta = rta:lower() + if rta:find('^' .. title) then + task:insert_result('REPLYTO_EMAIL_HAS_TITLE', 1.0) + end + end + end end -- See if Reply-To matches From in some way @@ -672,6 +685,9 @@ rspamd_config:register_virtual_symbol('REPLYTO_DOM_NEQ_FROM_DOM', 1.0, check_rep rspamd_config:set_metric_symbol('REPLYTO_DOM_NEQ_FROM_DOM', 0, 'Reply-To domain does not match the From domain') rspamd_config:register_virtual_symbol('REPLYTO_DN_EQ_FROM_DN', 1.0, check_replyto_id) rspamd_config:set_metric_symbol('REPLYTO_DN_EQ_FROM_DN', 0, 'Reply-To display name matches From') +rspamd_config:register_virtual_symbol('REPLYTO_EMAIL_HAS_TITLE', 1.0, check_replyto_id) +rspamd_config:set_metric_symbol('REPLYTO_EMAIL_HAS_TITLE', 2.0, check_replyto_id) +rspamd_config:register_dependency(check_replyto_id, check_from_id) local check_mime_id = rspamd_config:register_callback_symbol('CHECK_MIME', 1.0, function (task) |