]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] DMARC: Implement reporting.only_domains setting 5142/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 18 Sep 2024 10:57:49 +0000 (12:57 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 18 Sep 2024 10:57:49 +0000 (12:57 +0200)
src/plugins/lua/dmarc.lua

index 792672bd0de8dea693856ab48f801ea4316494e1..28b3db867c070890250e156105ff475974babba4 100644 (file)
@@ -264,6 +264,13 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld)
   end
 
   if policy.rua and redis_params and settings.reporting.enabled then
+    if settings.reporting.only_domains then
+      if not (settings.reporting.only_domains:get_key(policy.domain) or
+          settings.reporting.only_domains:get_key(rspamd_util.get_tld(policy.domain))) then
+        rspamd_logger.info(task, 'DMARC reporting suppressed for sender domain %s', policy.domain)
+        return
+      end
+    end
     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
@@ -527,6 +534,11 @@ if type(settings.reporting) == 'table' then
       type = 'map',
       description = 'Recipients not to store DMARC reports for'
     },
+    only_domains = {
+      optional = true,
+      type = 'map',
+      description = 'Domains to store DMARC reports about'
+    },
   })
 end