]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow to attach stat signature to messages
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 11 Jul 2017 07:25:11 +0000 (08:25 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 11 Jul 2017 07:25:11 +0000 (08:25 +0100)
src/plugins/lua/milter_headers.lua

index 52cd874a67ab8b412a24add5c027a5376268740a..009af075abdce2c3100a15d49ff09b0ab68edc3a 100644 (file)
@@ -112,6 +112,10 @@ local settings = {
         quarantine = 'DMARC_POLICY_QUARANTINE',
       },
     },
+    ['stat-signature'] = {
+      header = 'X-Stat-Signature',
+      remove = 1,
+    },
   },
 }
 
@@ -356,6 +360,18 @@ local function milter_headers(task)
     end
   end
 
+  routines['stat-signature'] = function()
+    if skip_wanted('stat-signature') then return end
+    if settings.routines['stat-signature'].remove then
+      remove[settings.routines['stat-signature'].header] =
+        settings.routines['stat-signature'].remove
+    end
+    local res = task:get_mempool():get_variable("stat_signature")
+    if res then
+      add[settings.routines['stat-signature'].header] = res
+    end
+  end
+
   for _, n in ipairs(active_routines) do
     local ok, err
     if custom_routines[n] then