if you print result.rcode you can see it has rcode=5 (REFUSED).
This is because your unbound resolver does not have any means to contact
DNS servers in the chaos class. The forward config you set with set_fwd
is for class IN.
My problem is that I wish to query several servers directly using a non-recursive query. Doing a recursive query would only return the value of "version.bind" (or "version.server") on the resolver.
But if you set_fwd the forwarder is sent a recursive query.
If you want to do nonrecursive queries you should set a stub-zone for
that domain.
If you want to send class CH queries there you need to set it for class
CH. However, the config file statements all default to class IN.
Except trustanchor statements and root-hints file, where a DNS file is
read in with class declarations inside.
Chris Hills wrote:
My problem is that I wish to query several servers directly using a
non-recursive query. Doing a recursive query would only return the value
of "version.bind" (or "version.server") on the resolver.
I am using the unbound library, but not the server.
I think you misunderstand my objective.
Whilst the normal operation of DNS is to discover a record recursively, there are some special records that are not part of the normal hierarchy and exist uniquely on each DNS server - for example, version.bind., version.server., hostname.bind. and id.server. (all chaos txt). Basically, I am trying to find the python code using pyunbound that does the equivalent the following command:-
dig @[dns-server] version.server. chaos txt
This will return the version of the software that is running on the dns server.
I am using the unbound library, but not the server.
right
I think you misunderstand my objective.
Tell me more
Whilst the normal operation of DNS is to discover a record recursively,
there are some special records that are not part of the normal hierarchy
and exist uniquely on each DNS server - for example, version.bind.,
version.server., hostname.bind. and id.server. (all chaos txt).
Basically, I am trying to find the python code using pyunbound that does
the equivalent the following command:-
dig @[dns-server] version.server. chaos txt
Unbound can do this sort of thing, as a server with root hints for class
chaos. However, the config syntax and libunbound functions all have a
default of class IN, and there is no way that I see to tell libunbound
where to send queries for class CHAOS.
This will return the version of the software that is running on the dns
server.
Or, well, whatever the operator configured, see the unbound options
'version' and 'hide-version'.
Perhaps you want this piece of python? :
(cin, cout) = os.popen2("dig @" + dnsserver + " version.bind chaos txt")
result = cout.readlines()
cin.close()
cout.close()
print result
Or, well, whatever the operator configured, see the unbound options
> 'version' and 'hide-version'.
Indeed, I thought that went without saying.
> Perhaps you want this piece of python? :
> (cin, cout) = os.popen2("dig @" + dnsserver + " version.bind chaos txt")
> result = cout.readlines()
> cin.close()
> cout.close()
> print result
I specifically wanted to use a library for this because spawning dig is inefficient, which makes a big difference when you are looking up a few million records Also, dig has the nasty habit of stalling when it gets stuck trying to locate the dns name. Although you can specify +tries=1 and +timeout=1, it still blocks whilst resolving the A/AAAA address of the target dns name (for example, if the target is ns1.something.example.com., and the two dns servers for something.example.com. are unavailable, it will hang for a lot longer than 2 seconds).
I have looked at several libraries for this, and so far none have met all my needs (multiple target servers, IPv6, chaos and asynchronous), and from your reply I can only infer that Unbound will not be suitable either Back to the drawing board! Thanks for your replies.
I specifically wanted to use a library for this because spawning dig is inefficient, which makes a big difference when you are looking up a few million records
Why do you need to query all the nameservers on the internet for their version?
Doesn't Caida.org already provide that ?
I have looked at several libraries for this, and so far none have met all my needs (multiple target servers, IPv6, chaos and asynchronous), and from your reply I can only infer that Unbound will not be suitable either Back to the drawing board! Thanks for your replies.
If your python code uses threads, do you really need an async interface?
I agree on both points and this is what we use for DNSdelve
<http://www.dnsdelve.net/>\. And parameter rdclass seems to allow
Python-DNS to query other classes than IN.