From: Andrew Lewis Date: Sun, 31 Jul 2016 13:33:48 +0000 (+0200) Subject: [Feature] Add DMARC_BAD_POLICY symbol when DMARC policy was invalid X-Git-Tag: 1.3.1~9^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=249df31d3b6382ba0c240858f208f8753ada1fba;p=thirdparty%2Frspamd.git [Feature] Add DMARC_BAD_POLICY symbol when DMARC policy was invalid --- diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua index d162b11640..45a30054ae 100644 --- a/src/plugins/lua/dmarc.lua +++ b/src/plugins/lua/dmarc.lua @@ -93,7 +93,7 @@ local function dmarc_callback(task) local strict_policy = false local quarantine_policy = false local found_policy = false - local failed_policy = false + local failed_policy local rua for _,r in ipairs(results) do @@ -103,7 +103,7 @@ local function dmarc_callback(task) return else if found_policy then - failed_policy = true + failed_policy = 'Multiple policies defined in DNS' return else found_policy = true @@ -118,7 +118,7 @@ local function dmarc_callback(task) if dkim_pol == 's' then strict_dkim = true elseif dkim_pol ~= 'r' then - failed_policy = true + failed_policy = 'adkim tag has invalid value' return end end @@ -127,7 +127,7 @@ local function dmarc_callback(task) if spf_pol == 's' then strict_spf = true elseif spf_pol ~= 'r' then - failed_policy = true + failed_policy = 'aspf tag has invalid value' return end end @@ -139,7 +139,7 @@ local function dmarc_callback(task) strict_policy = true quarantine_policy = true elseif (policy ~= 'none') then - failed_policy = true + failed_policy = 'p tag has invalid value' return end end @@ -160,7 +160,7 @@ local function dmarc_callback(task) quarantine_policy = false end else - failed_policy = true + failed_policy = 'sp tag has invalid value' return end end @@ -192,7 +192,10 @@ local function dmarc_callback(task) end end - if failed_policy then return end + if failed_policy then + task:insert_result('DMARC_BAD_POLICY', res, lookup_domain .. ' : ' .. failed_policy) + return + end -- Check dkim and spf symbols local spf_ok = false @@ -264,7 +267,6 @@ local function dmarc_callback(task) end end - -- XXX: handle rua and push data to redis end -- Do initial request