From: Andrew Lewis Date: Sun, 31 Jul 2016 13:34:38 +0000 (+0200) Subject: [Feature] Allow for setting action based on DMARC disposition X-Git-Tag: 1.3.1~9^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F774%2Fhead;p=rspamd.git [Feature] Allow for setting action based on DMARC disposition --- diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index 45a30054a..ef86cfd07 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -38,6 +38,7 @@ local dmarc_redis_key_prefix = "dmarc_" local dmarc_domain = nil local elts_re = rspamd_regexp.create_cached("\\\\{0,1};\\s+") local dmarc_reporting = false +local dmarc_actions = {} local function dmarc_report(task, spf_ok, dkim_ok, disposition) local ip = task:get_from_ip() @@ -267,6 +268,11 @@ local function dmarc_callback(task) end end + local force_action = dmarc_actions[disposition] + if force_action then + task:set_pre_result(force_action, 'Action set by DMARC') + end + end -- Do initial request @@ -286,6 +292,9 @@ end if opts['reporting'] == true then dmarc_reporting = true end +if type(opts['actions']) == 'table' then + dmarc_actions = opts['actions'] +end redis_params = rspamd_parse_redis_server('dmarc') if not redis_params then