]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Authentication-Results: support hiding usernames
authorAndrew Lewis <nerf@judo.za.org>
Mon, 11 Sep 2017 13:13:24 +0000 (15:13 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 24 Jan 2018 10:01:00 +0000 (12:01 +0200)
lualib/auth_results.lua
src/plugins/lua/milter_headers.lua

index edf13fff8f365d7b7c75b09666120b1485e332a0..9bcf881d7c32b34ed3584b3ea6a9f60c8ec03a8c 100644 (file)
@@ -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)
index a60eeb7edef82b6e7c2ad70aca23fd64050127b4..0bf3a5bcf94dc87c44c644a92da83926c46a248b 100644 (file)
@@ -111,6 +111,7 @@ local settings = {
         softfail = 'DMARC_POLICY_SOFTFAIL',
         quarantine = 'DMARC_POLICY_QUARANTINE',
       },
+      add_smtp_user = true,
     },
   },
 }