commit 09d344d: [Minor] Dmarc: Fix some munging issues

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Mar 2 15:07:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-03-02 14:33:09 +0000
URL: https://github.com/rspamd/rspamd/commit/09d344d3bc8d1469423610dbd28b6b134eae23ad

[Minor] Dmarc: Fix some munging issues

---
 src/plugins/lua/dmarc.lua | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index cc6c7f6a3..5a7122c8c 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -1538,7 +1538,7 @@ if opts.munging then
     local hdr_encoded = rspamd_util.fold_header('From',
             rspamd_util.mime_header_encode(string.format('%s <%s>',
                     from.name, via_addr)))
-    lua_mime.modify_headers({
+    lua_mime.modify_headers(task, {
       remove = {['From'] = {0}},
       add = {
         ['From'] = {order = 1, value = hdr_encoded},
@@ -1548,11 +1548,16 @@ if opts.munging then
     lua_util.debugm(N, task, 'munged DMARC header for %s: %s -> %s',
             from.domain, hdr_encoded, from.addr)
     rspamd_logger.infox(task, 'munged DMARC header for %s', from.domain)
+    task:insert_result('DMARC_MUNGED', 1.0, from.domain)
   end
 
   rspamd_config:register_symbol({
     name = 'DMARC_MUNGED',
     type = 'normal',
+    flags = 'nostat',
+    score = 0,
+    group = 'policies',
+    groups = {'dmarc'},
     callback = dmarc_munge_callback
   })
 
@@ -1560,4 +1565,6 @@ if opts.munging then
   -- To avoid dkim signing issues
   rspamd_config:register_dependency('DKIM_SIGNED', 'DMARC_MUNGED')
   rspamd_config:register_dependency('ARC_SIGNED', 'DMARC_MUNGED')
+
+  rspamd_logger.infox(rspamd_config, 'enabled DMARC munging')
 end
\ No newline at end of file


More information about the Commits mailing list