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

Unable to Perform Zone Transfer: The DNS query name does not exist: localhost #24

Closed
ross opened this issue May 19, 2023 · 4 comments · Fixed by #25
Closed

Unable to Perform Zone Transfer: The DNS query name does not exist: localhost #24

ross opened this issue May 19, 2023 · 4 comments · Fixed by #25

Comments

@ross
Copy link
Contributor

ross commented May 19, 2023

While looking into a test failure related to octodns/octodns#1004 I pulled the lasted code and tried to run tests, but got a failure to resolve localhost?

tests/test_provider_octodns_bind.py:28: in <module>
    class TestAxfrSource(TestCase):
tests/test_provider_octodns_bind.py:29: in TestAxfrSource
    source = AxfrSource('test', 'localhost')
octodns_bind/__init__.py:165: in __init__
    self.host = self._host(host)
octodns_bind/__init__.py:180: in _host
    raise AxfrSourceZoneTransferFailed(err) from None
E   octodns_bind.AxfrSourceZoneTransferFailed: Unable to Perform Zone Transfer: The DNS query name does not exist: localhost.

Guessing this is related to #22 and localhost isn't resolving when looked up on my computer/network. My first thought is to change the name there to an IP address...

@yzguy
Copy link
Contributor

yzguy commented May 19, 2023

Interesting.

If you do this below and see if it resolves.

>>> import dns.resolver
>>> dns.resolver.resolve('localhost')[0].address
'127.0.0.1'

@ross
Copy link
Contributor Author

ross commented May 19, 2023

>>> import dns.resolver
>>> dns.resolver.resolve('localhost')[0].address
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ross/octodns/octodns-bind/env/lib/python3.10/site-packages/dns/resolver.py", line 1368, in resolve
    return get_default_resolver().resolve(
  File "/Users/ross/octodns/octodns-bind/env/lib/python3.10/site-packages/dns/resolver.py", line 1190, in resolve
    (request, answer) = resolution.next_request()
  File "/Users/ross/octodns/octodns-bind/env/lib/python3.10/site-packages/dns/resolver.py", line 691, in next_request
    raise NXDOMAIN(qnames=self.qnames_to_try, responses=self.nxdomain_responses)
dns.resolver.NXDOMAIN: The DNS query name does not exist: localhost.

@ross
Copy link
Contributor Author

ross commented May 19, 2023

Fix over in #25

@yzguy
Copy link
Contributor

yzguy commented May 19, 2023

Oh this probably happens because dns.resolver does actually query a resolver immediately and doesn't go through the normal chain of things (host file, etc.) before making it. So in some cases you have like systemd-resolved dealing with that or whatever resolver may be running locally on the machine and then going to a real resolver, but if your resolver is 1.1.1.1 or something and it queries it, you won't get anything.

Interesting, may need to change that so it does the actual looking into host file, etc or just handle the localhost -> 127.0.0.1 in the code (which I don't love). Probably need to use socket.gethostbyname

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

Successfully merging a pull request may close this issue.

2 participants