From 133dd9fcba3613223553bd79e5ac33764c4f9b2d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 29 Sep 2018 00:48:38 +0200 Subject: [PATCH 1/2] transform UnknownTSIGKey into DnsUpdateError, fixes #337 this exception is catched in nsupdate.api.views._update_or_delete. --- nsupdate/main/dnstools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nsupdate/main/dnstools.py b/nsupdate/main/dnstools.py index 4daff10..a6529f1 100644 --- a/nsupdate/main/dnstools.py +++ b/nsupdate/main/dnstools.py @@ -214,6 +214,8 @@ def update(fqdn, ipaddr, ttl=60): # maybe could be caused by secondary DNS Timeout and master still ok? # assume the update is OK... ok = True + except dns.message.UnknownTSIGKey: + raise DnsUpdateError("UnknownTSIGKey") if ok: # only send an update if the ip really changed as the update # causes write I/O on the nameserver and also traffic to the From fc7e48d7a25e588f594d20eea01e8888005ccd05 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 29 Sep 2018 00:50:37 +0200 Subject: [PATCH 2/2] django-admin domains --check: catch UnknownTSIGKey, fixes #336 --- nsupdate/management/commands/domains.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nsupdate/management/commands/domains.py b/nsupdate/management/commands/domains.py index 26ff7d7..47ffbe5 100644 --- a/nsupdate/management/commands/domains.py +++ b/nsupdate/management/commands/domains.py @@ -3,6 +3,7 @@ dealing with domains (Domain records in our database) """ import dns.resolver +import dns.message from django.core.management.base import BaseCommand from django.core.mail import send_mail @@ -60,7 +61,7 @@ def check_dns(domain): query_ns(fqdn, 'SOA', prefer_primary=True) queries_ok = True except (dns.resolver.Timeout, dns.resolver.NoNameservers, - dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, NameServerNotAvailable): + dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, NameServerNotAvailable, dns.message.UnknownTSIGKey): # note: currently the domain is also set to unavailable as a # side effect in query_ns() queries_ok = False