From 1d0429e91e41bfd44a3d9c4818201f41009bca1f Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Mon, 11 Sep 2017 15:13:24 +0200 Subject: [PATCH] [Feature] Authentication-Results: support hiding usernames --- lualib/auth_results.lua | 16 +++++++++++++--- src/plugins/lua/milter_headers.lua | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lualib/auth_results.lua b/lualib/auth_results.lua index edf13fff8..9bcf881d7 100644 --- a/lualib/auth_results.lua +++ b/lualib/auth_results.lua @@ -50,6 +50,7 @@ local default_settings = { none = 'ARC_NA', reject = 'ARC_REJECT', }, + add_smtp_user = true, } local exports = {} @@ -172,10 +173,19 @@ local function gen_auth_results(task, settings) local hdr if #smtp_from[1]['addr'] > 0 then - hdr = string.format('auth=pass smtp.auth=%s smtp.mailfrom=%s', - u, smtp_from[1]['addr']) + if settings['add_smtp_user'] then + hdr = string.format('auth=pass smtp.auth=%s smtp.mailfrom=%s', + u, smtp_from[1]['addr']) + else + hdr = string.format('auth=pass smtp.mailfrom=%s', + smtp_from[1]['addr']) + end else - hdr = string.format('auth=pass smtp.auth=%s', u) + if settings['add_smtp_user'] then + hdr = string.format('auth=pass smtp.auth=%s', u) + else + hdr = 'auth=pass' + end end table.insert(hdr_parts, hdr) diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua index a60eeb7ed..0bf3a5bcf 100644 --- a/src/plugins/lua/milter_headers.lua +++ b/src/plugins/lua/milter_headers.lua @@ -111,6 +111,7 @@ local settings = { softfail = 'DMARC_POLICY_SOFTFAIL', quarantine = 'DMARC_POLICY_QUARANTINE', }, + add_smtp_user = true, }, }, } -- 2.39.5