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

Feature Request: support domains with just one label #87

Open
jahlives opened this issue Dec 17, 2021 · 4 comments
Open

Feature Request: support domains with just one label #87

jahlives opened this issue Dec 17, 2021 · 4 comments

Comments

@jahlives
Copy link

running into an issue with dino in my latest setup. When getting the zones from API the request result triggers an Exception in dino

pdns-server-mysql | 2021-12-17T08:21:59.114295366Z Dec 17 08:21:59 [webserver] 5930c55f-a4f4-4b2f-8d93-b516ce512bbb Result for "/api/v1/servers/localhost/zones": 200, body length: 26911
pdns-server-mysql | 2021-12-17T08:21:59.116869686Z Dec 17 08:21:59 [webserver] 5930c55f-a4f4-4b2f-8d93-b516ce512bbb 172.16.238.4:53216 "GET /api/v1/servers/localhost/zones HTTP/1.1" 200 27269
django_1    | 2021-12-17T08:21:59.494418135Z Internal Server Error: /zones
django_1    | 2021-12-17T08:21:59.494523021Z Traceback (most recent call last):
django_1    | 2021-12-17T08:21:59.494558397Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
django_1    | 2021-12-17T08:21:59.494589453Z     response = get_response(request)
django_1    | 2021-12-17T08:21:59.494619285Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
django_1    | 2021-12-17T08:21:59.494649873Z     response = self.process_exception_by_middleware(e, request)
django_1    | 2021-12-17T08:21:59.494679771Z   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
django_1    | 2021-12-17T08:21:59.494710317Z     response = wrapped_callback(request, *callback_args, **callback_kwargs)
django_1    | 2021-12-17T08:21:59.494740377Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 71, in view
django_1    | 2021-12-17T08:21:59.494770641Z     return self.dispatch(request, *args, **kwargs)
django_1    | 2021-12-17T08:21:59.494800329Z   File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/mixins.py", line 85, in dispatch
django_1    | 2021-12-17T08:21:59.494830917Z     return super().dispatch(request, *args, **kwargs)
django_1    | 2021-12-17T08:21:59.494860821Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 97, in dispatch
django_1    | 2021-12-17T08:21:59.494920557Z     return handler(request, *args, **kwargs)
django_1    | 2021-12-17T08:21:59.494955105Z   File "/app/dino/zoneeditor/views.py", line 45, in get
django_1    | 2021-12-17T08:21:59.494985381Z     return super().get(request, *args, **kwargs)
django_1    | 2021-12-17T08:21:59.495015279Z   File "/usr/local/lib/python3.9/site-packages/django/views/generic/list.py", line 142, in get
django_1    | 2021-12-17T08:21:59.495045597Z     self.object_list = self.get_queryset()
django_1    | 2021-12-17T08:21:59.495075339Z   File "/app/dino/zoneeditor/views.py", line 63, in get_queryset
django_1    | 2021-12-17T08:21:59.495105357Z     self._refresh_zones()
django_1    | 2021-12-17T08:21:59.495134871Z   File "/app/dino/zoneeditor/views.py", line 59, in _refresh_zones
django_1    | 2021-12-17T08:21:59.495165711Z     Zone.import_from_powerdns(pdns().get_zones())
django_1    | 2021-12-17T08:21:59.495195501Z   File "/app/dino/pdns_api/__init__.py", line 51, in get_zones
django_1    | 2021-12-17T08:21:59.495225585Z     return [
django_1    | 2021-12-17T08:21:59.495254871Z   File "/app/dino/pdns_api/__init__.py", line 52, in <listcomp>
django_1    | 2021-12-17T08:21:59.495285705Z     self._decode_name(z.name)
django_1    | 2021-12-17T08:21:59.495315129Z   File "/app/dino/pdns_api/__init__.py", line 44, in _decode_name
django_1    | 2021-12-17T08:21:59.495345123Z     return idna.decode(name)
django_1    | 2021-12-17T08:21:59.495374787Z   File "/usr/local/lib/python3.9/site-packages/idna/core.py", line 390, in decode
django_1    | 2021-12-17T08:21:59.495404967Z     s = ulabel(label)
django_1    | 2021-12-17T08:21:59.495471819Z   File "/usr/local/lib/python3.9/site-packages/idna/core.py", line 297, in ulabel
django_1    | 2021-12-17T08:21:59.495503091Z     check_label(label_bytes)
django_1    | 2021-12-17T08:21:59.495532869Z   File "/usr/local/lib/python3.9/site-packages/idna/core.py", line 228, in check_label
django_1    | 2021-12-17T08:21:59.495567765Z     raise IDNAError('Empty Label')
django_1    | 2021-12-17T08:21:59.495598311Z idna.core.IDNAError: Empty Label
django_1    | 2021-12-17T08:21:59.508143129Z [17/Dec/2021 08:21:59] "GET /zones HTTP/1.0" 500 115225

from my limited knowledge I would think that one domain in the list does not make dino happy. It's only the domain listing affected. I can see the zone in dino if going to zones/MY_DOMAIN.tld

How can I best narrow down which domain in the result causes the issue? There about 100 domains in my pdns :-)

I'm using PowerDNS Authoritative Server 4.5.1 is that is important

@jahlives
Copy link
Author

jahlives commented Dec 17, 2021

okay found that I had a domain named '.' in my pdns :-) Removed it and now I get this error

Reverse for 'zone_detail' with keyword arguments '{'zone': 'aorta.'}' not found. 1 pattern(s) tried:
 ['zones/(?P<zone>[_a-z¡-\uffff0-9](?:[a-z¡-\uffff0-9-]{0,61}[a-z¡-\uffff0-9])?(?:\\.(?!-)[_a-z¡-\uffff0-9-]{1,63}(?<!-))*\\.(?!-)(?:[a-z¡-\uffff-]{2,63}|xn--[a-z0-9]{1,59})(?<!-)\\.?)$']

aorta. is an internal zone just for my LAN hostnames. Works fine in pdns. Is it possible that dino struggles if it sees such a domain name without TLD-label?

@jahlives
Copy link
Author

weird, I renamed the zone in question to aorta.ch. API returns this "new" domain (the old one is not returned anymore). But when accessing zones in dino it still shows the error related to the old zonename. Is there something cached in dino? As said API does not return the name as shown in dino error message anymore.

@jahlives
Copy link
Author

ah it's in the mysql dino db in table synczones_zone Removed the old name from that table and can show zones in dino gui

Any chance that dino could be changed to accept domains without TLD-label? 👍 ;-)

@jahlives jahlives changed the title Exception upon fetching domain list Feature Request: support domains without a TLD label Dec 17, 2021
@jahlives
Copy link
Author

took the nuke-it-from-orbit approach to "fix" it ;-) and commented line 660 in /usr/local/lib/python3.9/site-packages/django/urls/resolvers.py

        raise NoReverseMatch(msg)

after that domain list is shown. Although dino errors when clicking on "aorta." domain, but that is okay with me as I hardly ever change anything in that zone. But all other zones work properly. So for me is fixed but I would really appreciate if dino could accept and show domains without TLD :-)

@jahlives jahlives changed the title Feature Request: support domains without a TLD label Feature Request: support domains with just one label Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant