aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/auth_results.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-01 15:07:37 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-01 15:24:26 +0100
commit8489874e86f3fa0b408a5a7b91c5dcb4c216d1a4 (patch)
treee975b015d5beeb053369b38a975179210600abdc /lualib/auth_results.lua
parentcaeab5bf0363fd8a77f5102a9647707abaa6c510 (diff)
downloadrspamd-8489874e86f3fa0b408a5a7b91c5dcb4c216d1a4.tar.gz
rspamd-8489874e86f3fa0b408a5a7b91c5dcb4c216d1a4.zip
[Minor] Add ARC check results to Authentication-Results
Diffstat (limited to 'lualib/auth_results.lua')
-rw-r--r--lualib/auth_results.lua26
1 files changed, 22 insertions, 4 deletions
diff --git a/lualib/auth_results.lua b/lualib/auth_results.lua
index 1b5b6e19f..c5fffb8e2 100644
--- a/lualib/auth_results.lua
+++ b/lualib/auth_results.lua
@@ -43,6 +43,13 @@ local default_settings = {
softfail = 'DMARC_POLICY_SOFTFAIL',
quarantine = 'DMARC_POLICY_QUARANTINE',
},
+ arc_symbols = {
+ pass = 'ARC_ALLOW',
+ permerror = 'ARC_INVALID',
+ temperror = 'ARC_DNSFAIL',
+ none = 'ARC_NA',
+ reject = 'ARC_REJECT',
+ },
}
local exports = {}
@@ -61,6 +68,7 @@ local function gen_auth_results(task, settings)
dkim = settings.dkim_symbols,
dmarc = settings.dmarc_symbols,
spf = settings.spf_symbols,
+ arc = settings.arc_symbols,
}
local common = {
@@ -99,6 +107,7 @@ local function gen_auth_results(task, settings)
for _, key in ipairs(keys) do
local hdr = ''
if auth_type == 'dmarc' and key ~= 'none' then
+ local opts = common.symbols[auth_types['dmarc'][key]][1]['options'] or {}
hdr = hdr .. 'dmarc='
if key == 'reject' or key == 'quarantine' or key == 'softfail' then
hdr = hdr .. 'fail'
@@ -106,10 +115,10 @@ local function gen_auth_results(task, settings)
hdr = hdr .. key
end
if key == 'pass' then
- hdr = hdr .. ' policy=' .. common.symbols[auth_types['dmarc'][key]][1]['options'][2]
- hdr = hdr .. ' header.from=' .. common.symbols[auth_types['dmarc'][key]][1]['options'][1]
+ hdr = hdr .. ' policy=' .. opts[2]
+ hdr = hdr .. ' header.from=' .. opts[1]
elseif key ~= 'none' then
- local t = global.rspamd_str_split(common.symbols[auth_types['dmarc'][key]][1]['options'][1], ' : ')
+ local t = global.rspamd_str_split(opts[1], ' : ')
local dom = t[1]
local rsn = t[2]
if rsn then
@@ -125,11 +134,20 @@ local function gen_auth_results(task, settings)
table.insert(hdr_parts, hdr)
elseif auth_type == 'dkim' and key ~= 'none' then
if common.symbols[auth_types['dkim'][key]][1] then
- for _, v in ipairs(common.symbols[auth_types['dkim'][key]][1]['options']) do
+ local opts = common.symbols[auth_types['dkim'][key]][1]['options']
+ for _, v in ipairs(opts) do
hdr = hdr .. auth_type .. '=' .. key .. ' header.d=' .. v
table.insert(hdr_parts, hdr)
end
end
+ elseif auth_type == 'arc' and key ~= 'none' then
+ if common.symbols[auth_types['arc'][key]][1] then
+ local opts = common.symbols[auth_types['arc'][key]][1]['options'] or {}
+ for _, v in ipairs(opts) do
+ hdr = hdr .. auth_type .. '=' .. key .. ' (' .. v .. ')'
+ table.insert(hdr_parts, hdr)
+ end
+ end
elseif auth_type == 'spf' and key ~= 'none' then
hdr = hdr .. auth_type .. '=' .. key
local smtp_from = task:get_from('smtp')