[GH-ISSUE #213] Traceback when using a malformed nameserver secret #192

Closed
opened 2026-02-26 09:36:26 +03:00 by kerem · 0 comments
Owner

Originally created by @ThomasWaldmann on GitHub (Jul 14, 2015).
Original GitHub issue: https://github.com/nsupdate-info/nsupdate.info/issues/213

I suspect that the custom domain used here was configured with a incorrect / malformed nameserver secret, so it triggers issues when host add or ip update try to use it (see tracebacks below).

Maybe we can avoid that early by validating the domain form data when the custom domain is about to get added.

When adding a host to that domain:

Internal Server Error: /host/add/
Traceback (most recent call last):
...
  File "/srv/nsupdate.info/repo/nsupdate/main/views.py", line 202, in dispatch
    return super(AddHostView, self).dispatch(*args, **kwargs)
  File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 207, in post
    return super(BaseCreateView, self).post(request, *args, **kwargs)
  File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 173, in post
    return self.form_valid(form)
  File "/srv/nsupdate.info/repo/nsupdate/main/views.py", line 216, in form_valid
    dnstools.add(self.object.get_fqdn(), normalize_ip(self.request.META['REMOTE_ADDR']))
  File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 128, in add
    update_ns(fqdn, rdtype, ipaddr, action=action, ttl=ttl)
  File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 308, in update_ns
    keyring=dns.tsigkeyring.from_text({keyname: key}),
  File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/dns/tsigkeyring.py", line 30, in from_text
    secret = base64.decodestring(textring[keytext])
  File "/usr/lib/python2.7/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)
Error: Incorrect padding

When updating a host in that domain:

Internal Server Error: /nic/update
Traceback (most recent call last):
...
  File "/srv/nsupdate.info/repo/nsupdate/api/views.py", line 237, in get
    return _update_or_delete(host, ipaddr, secure, logger=logger, _delete=delete)
  File "/srv/nsupdate.info/repo/nsupdate/api/views.py", line 361, in _update_or_delete
    update(fqdn, ipaddr)
  File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 193, in update
    update_ns(fqdn, rdtype, ipaddr, action='upd', ttl=ttl)
  File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 308, in update_ns
    keyring=dns.tsigkeyring.from_text({keyname: key}),
  File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/dns/tsigkeyring.py", line 30, in from_text
    secret = base64.decodestring(textring[keytext])
  File "/usr/lib/python2.7/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)
Error: Incorrect padding
Originally created by @ThomasWaldmann on GitHub (Jul 14, 2015). Original GitHub issue: https://github.com/nsupdate-info/nsupdate.info/issues/213 I suspect that the custom domain used here was configured with a incorrect / malformed nameserver secret, so it triggers issues when host add or ip update try to use it (see tracebacks below). Maybe we can avoid that early by validating the domain form data when the custom domain is about to get added. When adding a host to that domain: ``` Internal Server Error: /host/add/ Traceback (most recent call last): ... File "/srv/nsupdate.info/repo/nsupdate/main/views.py", line 202, in dispatch return super(AddHostView, self).dispatch(*args, **kwargs) File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch return handler(request, *args, **kwargs) File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 207, in post return super(BaseCreateView, self).post(request, *args, **kwargs) File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/django/views/generic/edit.py", line 173, in post return self.form_valid(form) File "/srv/nsupdate.info/repo/nsupdate/main/views.py", line 216, in form_valid dnstools.add(self.object.get_fqdn(), normalize_ip(self.request.META['REMOTE_ADDR'])) File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 128, in add update_ns(fqdn, rdtype, ipaddr, action=action, ttl=ttl) File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 308, in update_ns keyring=dns.tsigkeyring.from_text({keyname: key}), File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/dns/tsigkeyring.py", line 30, in from_text secret = base64.decodestring(textring[keytext]) File "/usr/lib/python2.7/base64.py", line 321, in decodestring return binascii.a2b_base64(s) Error: Incorrect padding ``` When updating a host in that domain: ``` Internal Server Error: /nic/update Traceback (most recent call last): ... File "/srv/nsupdate.info/repo/nsupdate/api/views.py", line 237, in get return _update_or_delete(host, ipaddr, secure, logger=logger, _delete=delete) File "/srv/nsupdate.info/repo/nsupdate/api/views.py", line 361, in _update_or_delete update(fqdn, ipaddr) File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 193, in update update_ns(fqdn, rdtype, ipaddr, action='upd', ttl=ttl) File "/srv/nsupdate.info/repo/nsupdate/main/dnstools.py", line 308, in update_ns keyring=dns.tsigkeyring.from_text({keyname: key}), File "/srv/nsupdate.info/env/local/lib/python2.7/site-packages/dns/tsigkeyring.py", line 30, in from_text secret = base64.decodestring(textring[keytext]) File "/usr/lib/python2.7/base64.py", line 321, in decodestring return binascii.a2b_base64(s) Error: Incorrect padding ```
kerem 2026-02-26 09:36:26 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nsupdate.info-nsupdate-info#192
No description provided.