Add new dkim.DnsTimeoutError class to report queried domain and selector

along with timeout error from dnspython (LP: #1873449)
This commit is contained in:
Scott Kitterman
2023-02-25 16:44:06 -05:00
parent 233a9699ed
commit b74452d9da
2 changed files with 12 additions and 2 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
Version 1.1 Version 1.1.0
- Add domain validity check for ascii domains (no specials) - Add domain validity check for ascii domains (no specials)
- Add option to specify index number of signature to verify to dkimverify - Add option to specify index number of signature to verify to dkimverify
(Thanks to Nick Baugh for the change) (Thanks to Nick Baugh for the change)
@@ -14,7 +14,9 @@ Version 1.1
#1978835) - Thanks to Adrien (spitap) for the change #1978835) - Thanks to Adrien (spitap) for the change
- Add limitations section to README to document current IDN status - Add limitations section to README to document current IDN status
- Add USE_ASYNC flag to allow async to be disabled when aiodns is - Add USE_ASYNC flag to allow async to be disabled when aiodns is
installed (LP: #1954331) - see README.md for details installed (LP: #1954331) - see README.md for details
- Add new dkim.DnsTimeoutError class to report queried domain and selector
along with timeout error from dnspython (LP: #1873449)
2019-12-31 Version 1.0.2 2019-12-31 Version 1.0.2
- dknewkey: On posix operating systems set file permissions to 600 for - dknewkey: On posix operating systems set file permissions to 600 for
+8
View File
@@ -101,6 +101,7 @@ __all__ = [
"ValidationError", "ValidationError",
"AuthresNotFoundError", "AuthresNotFoundError",
"NaClNotFoundError", "NaClNotFoundError",
"DnsTimeoutError",
"USE_ASYNC", "USE_ASYNC",
"CV_Pass", "CV_Pass",
"CV_Fail", "CV_Fail",
@@ -195,6 +196,9 @@ class NaClNotFoundError(DKIMException):
class UnknownKeyTypeError(DKIMException): class UnknownKeyTypeError(DKIMException):
""" Key type (k tag) is not known (rsa/ed25519) """ """ Key type (k tag) is not known (rsa/ed25519) """
class DnsTimeoutError(DKIMException):
""" DNS query for public key timed out """
def select_headers(headers, include_headers): def select_headers(headers, include_headers):
"""Select message header fields to be signed/verified. """Select message header fields to be signed/verified.
@@ -796,6 +800,10 @@ class DomainSigner(object):
except binascii.Error as e: except binascii.Error as e:
self.logger.error('KeyFormatError: {0}'.format(e)) self.logger.error('KeyFormatError: {0}'.format(e))
return False return False
except dns.exception.Timeout as e:
self.logger.error('DnsTimeoutError: Domain: {0} Selector: {1} Error message: {2}'.format(
sig[b'd'], sig[b's'], e))
return False
return self.verify_sig_process(sig, include_headers, sig_header, dnsfunc) return self.verify_sig_process(sig, include_headers, sig_header, dnsfunc)