From: Andrew Lewis Date: Tue, 13 Mar 2018 09:46:21 +0000 (+0200) Subject: [Feature] Whitelist for emails module X-Git-Tag: 1.7.1~65^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F2070%2Fhead;p=rspamd.git [Feature] Whitelist for emails module --- 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({