Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some library settings were not taking effect #93

Merged
merged 3 commits into from
Oct 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion trustymail/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import unicode_literals, absolute_import, print_function

__version__ = '0.6.0'
__version__ = '0.6.1'

PublicSuffixListFilename = 'public_suffix_list.dat'
PublicSuffixListReadOnly = False
27 changes: 17 additions & 10 deletions trustymail/trustymail.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,22 +540,29 @@ def scan(domain_name, timeout, smtp_timeout, smtp_localhost, smtp_ports, smtp_ca
# Configure the dnspython library
#

# Set some timeouts
dns.resolver.timeout = float(timeout)
dns.resolver.lifetime = float(timeout)

# Our resolver
#
# Note that it uses the system configuration in /etc/resolv.conf
# if no DNS hostnames are specified.
resolver = dns.resolver.Resolver(configure=not dns_hostnames)
# Retry DNS servers if we receive a SERVFAIL response from them. We set
# this to False because, unless the reason for the SERVFAIL is truly
# temporary and resolves before trustymail finishes scanning the domain,
# this obscures the potentially informative SERVFAIL error as a DNS timeout
# because of the way dns.resolver.query() is written. See
# http://www.dnspython.org/docs/1.14.0/dns.resolver-pysrc.html#query.
# This is a setting that controls whether we retry DNS servers if
# we receive a SERVFAIL response from them. We set this to False
# because, unless the reason for the SERVFAIL is truly temporary
# and resolves before trustymail finishes scanning the domain,
# this can obscure the potentially informative SERVFAIL error as a
# DNS timeout because of the way dns.resolver.query() is written.
# See
# http://www.dnspython.org/docs/1.14.0/dns.resolver-pysrc.html#Resolver.query.
resolver.retry_servfail = False
# Set some timeouts. The timeout should be less than or equal to
# the lifetime, but longer than the time a DNS server takes to
# return a SERVFAIL (since otherwise it's possible to get a DNS
# timeout when you should be getting a SERVFAIL.) See
# http://www.dnspython.org/docs/1.14.0/dns.resolver-pysrc.html#Resolver.query
# and
# http://www.dnspython.org/docs/1.14.0/dns.resolver-pysrc.html#Resolver._compute_timeout.
resolver.timeout = float(timeout)
resolver.lifetime = float(timeout)
# If the user passed in DNS hostnames to query against then use them
if dns_hostnames:
resolver.nameservers = dns_hostnames
Expand Down