diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-07-31 15:34:38 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-07-31 15:34:38 +0200 |
commit | 54cdc4f29ff4fef7822b528cd2a09fe66f43dee6 (patch) | |
tree | 91ec9b794f8bce77d08861835a8cec2856bdecf3 /src/plugins/lua/dmarc.lua | |
parent | 249df31d3b6382ba0c240858f208f8753ada1fba (diff) | |
download | rspamd-54cdc4f29ff4fef7822b528cd2a09fe66f43dee6.tar.gz rspamd-54cdc4f29ff4fef7822b528cd2a09fe66f43dee6.zip |
[Feature] Allow for setting action based on DMARC disposition
Diffstat (limited to 'src/plugins/lua/dmarc.lua')
-rw-r--r-- | src/plugins/lua/dmarc.lua | 9 |
1 files changed, 9 insertions, 0 deletions
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 |