Skip to content

Commit 3c1e8f1

Browse files
committed
Add warning if sp tag is explicitly set for a subdomain
This isn't an error, but according to RFC7489, "'sp' will be ignored for DMARC records published on subdomains of Organizational Domains due to the effect of the DMARC policy discovery mechanism." Therefore we want to warn users that the sp tag they have explicitly set is probably not doing what they intended. See here for more details: https://tools.ietf.org/html/rfc7489#section-6.3
1 parent 788c17a commit 3c1e8f1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

trustymail/trustymail.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,11 @@ def dmarc_scan(resolver, domain):
493493
value = options.split('=')[1].strip()
494494
tag_dict[tag] = value
495495

496+
# Before we set sp=p if it is not explicitly contained in
497+
# the DMARC record, log a warning if it is explicitly set
498+
# for a subdomain of an organizational domain.
499+
if 'sp' in tag_dict and not domain.is_base_domain:
500+
handle_error('[DMARC]', domain, 'Warning: The sp tag will be ignored for DMARC records published on subdomains. See here for details: https://tools.ietf.org/html/rfc7489#section-6.3.', syntax_error=False)
496501
if 'p' not in tag_dict:
497502
msg = 'Record missing required policy (p) tag'
498503
handle_syntax_error('[DMARC]', domain, '{0}'.format(msg))

0 commit comments

Comments
 (0)