summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-29 14:45:57 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-29 14:45:57 +0100
commit35c422bdef9ed574445d20efa17f61079e826d5a (patch)
tree421fcb4b689bf6facaf5fe0a945eb186920d5e3d /src
parent9162a5922e714070c5e1483e7aedf3c1728e61c9 (diff)
downloadrspamd-35c422bdef9ed574445d20efa17f61079e826d5a.tar.gz
rspamd-35c422bdef9ed574445d20efa17f61079e826d5a.zip
[Feature] Rbl: Support replyto addresses
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/rbl.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 512a3ae10..093d6ca11 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -559,6 +559,38 @@ local function gen_rbl_callback(rule)
return true
end
+ local function check_replyto(task, requests_table, whitelist)
+ local function get_raw_header(name)
+ return ((task:get_header_full(name) or {})[1] or {})['value']
+ end
+
+ local replyto = get_raw_header('Reply-To')
+ if replyto then
+ local rt = rspamd_util.parse_mail_address(replyto, task:get_mempool())
+
+ if rt and rt[1] and (rt[1].addr and #rt[1].addr > 0) then
+ lua_util.remove_email_aliases(rt[1])
+ rt[1].addr = rt[1].addr:lower()
+ if rule.emails_domainonly then
+ add_dns_request(task, rt[1].addr, true, false, requests_table,
+ 'email replyto', whitelist)
+ else
+ if rule.hash then
+ -- Leave @ as is
+ add_dns_request(task, string.format('%s@%s',
+ rt[1].user, rt[1].host), false, false,
+ requests_table, 'email replyto', whitelist)
+ else
+ -- Replace @ with .
+ add_dns_request(task, string.format('%s.%s',
+ rt[1].user, rt[1].host), false, false,
+ requests_table, 'email replyto', whitelist)
+ end
+ end
+ end
+ end
+ end
+
-- Create function pipeline depending on rbl settings
local pipeline = {
is_alive, -- generic for all
@@ -591,6 +623,10 @@ local function gen_rbl_callback(rule)
pipeline[#pipeline + 1] = check_emails
description[#description + 1] = 'emails'
end
+ if rule.replyto then
+ pipeline[#pipeline + 1] = check_replyto
+ description[#description + 1] = 'replyto'
+ end
if rule.urls then
pipeline[#pipeline + 1] = check_urls
@@ -900,6 +936,8 @@ local default_options = {
['default_ignore_whitelist'] = false,
['default_resolve_ip'] = false,
['default_no_ip'] = false,
+ ['default_images'] = false,
+ ['default_replyto'] = false,
}
opts = lua_util.override_defaults(default_options, opts)