]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Support suppressing DMARC reporting for particular recipients 4772/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 10 Jan 2024 13:38:39 +0000 (15:38 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 10 Jan 2024 13:38:39 +0000 (15:38 +0200)
src/plugins/lua/dmarc.lua

index 99fede96a32d3b35ea45cd7b1d2a4cad93d1e42e..792672bd0de8dea693856ab48f801ea4316494e1 100644 (file)
@@ -267,7 +267,14 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld)
     if settings.reporting.exclude_domains then
       if settings.reporting.exclude_domains:get_key(policy.domain) or
           settings.reporting.exclude_domains:get_key(rspamd_util.get_tld(policy.domain)) then
-        rspamd_logger.infox(task, 'DMARC reporting suppressed for %s', policy.domain)
+        rspamd_logger.info(task, 'DMARC reporting suppressed for sender domain %s', policy.domain)
+        return
+      end
+    end
+    if settings.reporting.exclude_recipients then
+      local rcpt = task:get_principal_recipient()
+      if rcpt and settings.reporting.exclude_recipients:get_key(rcpt) then
+        rspamd_logger.info(task, 'DMARC reporting suppressed for recipient %s', rcpt)
         return
       end
     end
@@ -515,6 +522,11 @@ if type(settings.reporting) == 'table' then
       type = 'map',
       description = 'Domains not to store DMARC reports about'
     },
+    exclude_recipients = {
+      optional = true,
+      type = 'map',
+      description = 'Recipients not to store DMARC reports for'
+    },
   })
 end