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 - Ability to control RD (Recursion Desired) flag #308

Open
hlein opened this issue Sep 6, 2024 · 0 comments
Open

Feature Request - Ability to control RD (Recursion Desired) flag #308

hlein opened this issue Sep 6, 2024 · 0 comments

Comments

@hlein
Copy link

hlein commented Sep 6, 2024

Feature Request

It would be nice to have a knob to control whether the RD (Recursion Desired) bit is set.

I'm in a situation where I am talking to an internal DNS server that is authoritative for some zones, but I do not know which. It has upstream forwarders configured, however those upstreams will not actually answer the questions it is forwarding on my behalf.

To Reproduce

...You probably can't, without this strange setup, but here's an example of how unsetting RD makes a huge difference:

# time dig -x 10.0.1.2
;; communications error to 10.3.1.37#53: timed out
;; communications error to 10.3.1.37#53: timed out
;; communications error to 10.3.1.37#53: timed out
;; communications error to 10.3.1.37#53: timed out

; <<>> DiG 9.20.1-1-Debian <<>> -x 10.0.1.2
;; global options: +cmd
;; no servers could be reached

real    0m20.035s
user    0m0.010s
sys     0m0.011s

A ~20s timeout between requests is also reflected in dnsrecon's performance (albeit with multiple parallel queries timing out at once).

OTOH, turning off RD fails quickly:

# time dig +norecurse -x 10.0.1.2
; <<>> DiG 9.20.1-1-Debian <<>> +norecurse -x 10.0.1.2
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 62261
;; flags: qr ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;2.1.0.10.in-addr.arpa.      IN      PTR

;; Query time: 0 msec
;; SERVER: 10.3.1.37#53(10.3.1.37) (UDP)
;; WHEN: Fri Sep 06 15:48:26 EDT 2024
;; MSG SIZE  rcvd: 53


real    0m0.016s
user    0m0.008s

The dns.message.make_query call does support passing flags, and there's an example of setting flags=0 to turn off RD here:
https://github.com/rthalley/dnspython/blob/main/examples/query_specific.py

It would be nice if there was a flag to dnsrecon to expose this / turn off RD; AFAIK there isn't one. There is a --disable_check_recursion but that is different.

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