aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/emails.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2018-03-13 11:46:21 +0200
committerAndrew Lewis <nerf@judo.za.org>2018-03-13 11:46:21 +0200
commit90e643e64c84637ca66d935c24925fd614ad2d18 (patch)
treedb38a41c0fbfdee168c94abd84363ed12133dcca /src/plugins/lua/emails.lua
parent6b68e89410bf70ca4de74aad125d16bcecf99f62 (diff)
downloadrspamd-90e643e64c84637ca66d935c24925fd614ad2d18.tar.gz
rspamd-90e643e64c84637ca66d935c24925fd614ad2d18.zip
[Feature] Whitelist for emails module
Diffstat (limited to 'src/plugins/lua/emails.lua')
-rw-r--r--src/plugins/lua/emails.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/lua/emails.lua b/src/plugins/lua/emails.lua
index 65e6b433e..12e94a932 100644
--- a/src/plugins/lua/emails.lua
+++ b/src/plugins/lua/emails.lua
@@ -32,6 +32,13 @@ local N = "emails"
-- Check rule for a single email
local function check_email_rule(task, rule, addr)
+ if rule['whitelist'] then
+ if rule['whitelist']:get_key(addr.addr)
+ or rule['whitelist']:get_key(addr.domain) then
+ logger.debugm(N, task, "whitelisted address: %s", addr.addr)
+ return
+ end
+ end
if rule['dnsbl'] then
local email
local to_resolve
@@ -175,6 +182,14 @@ if opts and type(opts) == 'table' then
rule['delimiter'] = "@"
end
+ if rule['whitelist'] then
+ rule['whitelist'] = rspamd_config:add_map({
+ url = rule['whitelist'],
+ description = string.format('Emails rule %s whitelist', rule['symbol']),
+ type = 'set'
+ })
+ end
+
if rule['map'] then
rule['name'] = rule['map']
rule['map'] = rspamd_config:add_map({