From 90e643e64c84637ca66d935c24925fd614ad2d18 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 13 Mar 2018 11:46:21 +0200 Subject: [PATCH] [Feature] Whitelist for emails module --- src/plugins/lua/emails.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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({ -- 2.39.5