-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
systemd version the issue has been seen with
255.4
Used distribution
Ubuntu 24.04
Linux kernel version used
6.8.0-41-generic
CPU architectures issue was seen on
aarch64
Component
systemd-resolved
Expected behaviour you didn't see
Querying a domain with no dots as a fully qualified domain should return NXDOMAIN if its not found, such as:
dig +ndots=0 www should return NXDOMAIN, but its not, its returning SERVFAIL.
But when querying for a domain with at least 1 dot, that is definitely not valid, we do indeed get NXDOMAIN:
$ dig asdfasdfasa.asdfasfasg
; <<>> DiG 9.18.28-0ubuntu0.24.04.1-Ubuntu <<>> asdfasdfasa.asdfasfasg
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 56010
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;asdfasdfasa.asdfasfasg. IN A
;; AUTHORITY SECTION:
. 86337 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2024082201 1800 900 604800 86400
;; Query time: 34 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri Aug 23 00:03:39 UTC 2024
;; MSG SIZE rcvd: 126
While this may not seem like a significant issue, we are starting to see containers deploy with ndots:0 such as in: c-ares/c-ares#734 (comment)
And the docs for resolv.conf and ndots say:
Sets a threshold for the number of dots which must appear in a name given to res_query(3) (see resolver(3)) before an initial absolute query will be made. The default for n is 1, meaning that if there are any dots in a name, the name will be tried first as an absolute name before any search list elements are appended to it.
So if there are search domains set, ndots:0 just make it search the bare first then if that's not found, tries search suffixes.
But in general, this search logic should depend on NXDOMAIN to know to continue on, a SERVFAIL typically means there's something wrong with the upstream DNS server, so like with c-ares, the search stops as happened in c-ares/c-ares#852 (comment)
Unexpected behaviour you saw
$ dig +ndots=0 www
; <<>> DiG 9.18.28-0ubuntu0.24.04.1-Ubuntu <<>> +ndots www
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 30078
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;www. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Fri Aug 23 00:00:11 UTC 2024
;; MSG SIZE rcvd: 32
Steps to reproduce the problem
attempt a bare query with no dots, when your system config allows ndots:0
Additional program output to the terminal or log subsystem illustrating the issue
No response