From 54cdc4f29ff4fef7822b528cd2a09fe66f43dee6 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Sun, 31 Jul 2016 15:34:38 +0200 Subject: [PATCH] [Feature] Allow for setting action based on DMARC disposition --- src/plugins/lua/dmarc.lua | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.39.5