diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-28 13:39:23 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-28 13:39:23 +0000 |
commit | a171bcffba32c751a5c40c5d795fb6c36c4f83d9 (patch) | |
tree | 3bbdd5ed4bebd1f03a03e92327d3b8cedb216f7c /src | |
parent | 3a995b7221266ab58f8b3fac8fb02e70c23c42a9 (diff) | |
download | rspamd-a171bcffba32c751a5c40c5d795fb6c36c4f83d9.tar.gz rspamd-a171bcffba32c751a5c40c5d795fb6c36c4f83d9.zip |
[Fix] Perform policy downgrade on sample out, add tests
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/lua/dmarc.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index af43a5b8c..1bac6fb29 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -419,11 +419,19 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld) if (coin > policy.pct) then if (not no_sampling_domains or not no_sampling_domains:get_key(policy.domain)) then - task:insert_result(dmarc_symbols['softfail'], 1.0, + + if what == 'reject' then + disposition = 'quarantine' + else + disposition = 'softfail' + end + + task:insert_result(dmarc_symbols[disposition], 1.0, policy.domain .. ' : ' .. reason_str, policy.dmarc_policy, "sampled_out") sampled_out = true - lua_util.debugm(N, task, 'changed dmarc policy from %s to %s, sampled out: %s < %s', - what, 'softfail', coin, policy.pct) + lua_util.debugm(N, task, + 'changed dmarc policy from %s to %s, sampled out: %s < %s', + what, disposition, coin, policy.pct) else task:insert_result(dmarc_symbols[what], 1.0, policy.domain .. ' : ' .. reason_str, policy.dmarc_policy, "local_policy") |