]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Dmarc: Move `no_reporting_domains` to `reporting.exclude_domains`
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 16 Sep 2022 21:05:06 +0000 (22:05 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 16 Sep 2022 21:05:06 +0000 (22:05 +0100)
This is done for consistency with provision of the backward compatibility

src/plugins/lua/dmarc.lua

index 99d909154f05618bbbab61c2b37032087aa9be84..17ef5c2749fbeebec74a4f189fa128798b007d3d 100644 (file)
@@ -266,9 +266,9 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld)
   end
 
   if policy.rua and redis_params and settings.reporting.enabled then
-    if settings.no_reporting_domains then
-      if settings.no_reporting_domains:get_key(policy.domain) or
-          settings.no_reporting_domains:get_key(rspamd_util.get_tld(policy.domain)) then
+    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)
         return
       end
@@ -499,6 +499,11 @@ settings = lua_util.override_defaults(settings, opts)
 settings.auth_and_local_conf = lua_util.config_check_local_or_authed(rspamd_config, N,
     false, false)
 
+-- Legacy...
+if settings.reporting and not settings.reporting.exclude_domains and settings.no_reporting_domains then
+  settings.reporting.exclude_domains = settings.no_reporting_domains
+end
+
 local lua_maps = require "lua_maps"
 lua_maps.fill_config_maps(N, settings, {
   no_sampling_domains = {
@@ -506,13 +511,18 @@ lua_maps.fill_config_maps(N, settings, {
     type = 'map',
     description = 'Domains not to apply DMARC sampling to'
   },
-  no_reporting_domains = {
-    optional = true,
-    type = 'map',
-    description = 'Domains not to apply DMARC reporting to'
-  },
 })
 
+if type(settings.reporting) == 'table' then
+  lua_maps.fill_config_maps(N, settings.reporting, {
+    exclude_domains = {
+      optional = true,
+      type = 'map',
+      description = 'Domains not to store DMARC reports about'
+    },
+  })
+end
+
 
 if settings.reporting == true then
   rspamd_logger.errx(rspamd_config, 'old style dmarc reporting is NO LONGER supported, please read the documentation')