From: Vsevolod Stakhov Date: Thu, 5 Aug 2021 20:05:22 +0000 (+0100) Subject: [Minor] Dmarc_report: fix report domain check for 3rd party domains X-Git-Tag: 3.0~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f57c944b0338b51a3cb6c37b8fa84508f75f8a9;p=rspamd.git [Minor] Dmarc_report: fix report domain check for 3rd party domains --- diff --git a/lualib/rspamadm/dmarc_report.lua b/lualib/rspamadm/dmarc_report.lua index fcc4f5e7f..d9ae40e99 100644 --- a/lualib/rspamadm/dmarc_report.lua +++ b/lualib/rspamadm/dmarc_report.lua @@ -303,13 +303,13 @@ local function process_rua(reporting_domain, rua) local u = rspamd_url.create(pool, a:gsub('!%d+[kmg]?$', '')) if u then -- Check each address for sanity - if u:get_tld() == reporting_domain then + if reporting_domain == u:get_tld() or reporting_domain == u:get_host() then -- Same domain - always include table.insert(addrs, u) else -- We need to check authority local resolve_str = string.format('%s._report._dmarc.%s', - reporting_domain, u:get_tld()) + reporting_domain, u:get_host()) local is_ok, results = rspamd_dns.request({ config = rspamd_config, session = rspamadm_session, @@ -318,7 +318,7 @@ local function process_rua(reporting_domain, rua) }) if not is_ok then - logger.errx('cannot resolve %s: %s; exclude %s', reporting_domain, results, a) + logger.errx('cannot resolve %s: %s; exclude %s', resolve_str, results, a) else local found = false for _,t in ipairs(results) do @@ -357,7 +357,7 @@ local function validate_reporting_domain(reporting_domain) name = '_dmarc.' .. reporting_domain , }) - if not is_ok then + if not is_ok or not results then logger.errx('cannot resolve _dmarc.%s: %s', reporting_domain, results) return nil end