Skip to content

Commit

Permalink
[Minor] Dmarc: Move no_reporting_domains to `reporting.exclude_doma…
Browse files Browse the repository at this point in the history
…ins`

This is done for consistency with provision of the backward compatibility
  • Loading branch information
vstakhov committed Sep 16, 2022
1 parent aa41958 commit d39a5d3
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/plugins/lua/dmarc.lua
Expand Up @@ -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
Expand Down Expand Up @@ -499,20 +499,30 @@ 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 = {
optional = true,
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')
Expand Down

0 comments on commit d39a5d3

Please sign in to comment.