Skip to content

Commit

Permalink
Merge 3c1e8f1 into a26588a
Browse files Browse the repository at this point in the history
  • Loading branch information
jsf9k committed Apr 25, 2019
2 parents a26588a + 3c1e8f1 commit e6cbb10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion trustymail/__init__.py
@@ -1,6 +1,6 @@
from __future__ import unicode_literals, absolute_import, print_function

__version__ = '0.7.3'
__version__ = '0.7.4'

PublicSuffixListFilename = 'public_suffix_list.dat'
PublicSuffixListReadOnly = False
5 changes: 3 additions & 2 deletions trustymail/domain.py
Expand Up @@ -65,14 +65,15 @@ def __init__(self, domain_name, timeout, smtp_timeout, smtp_localhost, smtp_port

self.base_domain_name = get_public_suffix(self.domain_name)

self.is_base_domain = True
self.base_domain = None
if self.base_domain_name != self.domain_name:
self.is_base_domain = False
if self.base_domain_name not in Domain.base_domains:
# Populate DMARC for parent.
domain = trustymail.scan(self.base_domain_name, timeout, smtp_timeout, smtp_localhost, smtp_ports, smtp_cache, {'mx': False, 'starttls': False, 'spf': False, 'dmarc': True}, dns_hostnames)
Domain.base_domains[self.base_domain_name] = domain
self.base_domain = Domain.base_domains[self.base_domain_name]
else:
self.base_domain = None

# Start off assuming the host is live unless an error tells us otherwise.
self.is_live = True
Expand Down
7 changes: 6 additions & 1 deletion trustymail/trustymail.py
Expand Up @@ -493,6 +493,11 @@ def dmarc_scan(resolver, domain):
value = options.split('=')[1].strip()
tag_dict[tag] = value

# Before we set sp=p if it is not explicitly contained in
# the DMARC record, log a warning if it is explicitly set
# for a subdomain of an organizational domain.
if 'sp' in tag_dict and not domain.is_base_domain:
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)
if 'p' not in tag_dict:
msg = 'Record missing required policy (p) tag'
handle_syntax_error('[DMARC]', domain, '{0}'.format(msg))
Expand All @@ -505,7 +510,7 @@ def dmarc_scan(resolver, domain):
tag_dict['pct'] = 100
if 'adkim' not in tag_dict:
tag_dict['adkim'] = 'r'
if 'aspf'not in tag_dict:
if 'aspf' not in tag_dict:
tag_dict['aspf'] = 'r'
if 'fo' not in tag_dict:
tag_dict['fo'] = '0'
Expand Down

0 comments on commit e6cbb10

Please sign in to comment.