containers / aardvark-dns

Authoritative dns server for A/AAAA container records. Forwards other request to host's /etc/resolv.conf
Apache License 2.0
186 stars 32 forks source link

Setting invalid options in /etc/resolv.conf makes dns unresponsive #418

Closed aleksanderdidriksen closed 1 month ago

aleksanderdidriksen commented 10 months ago

If you set invalid options in /etc/resolv.conf aardvark-dns will be unresponsive. It will run, but does not give any error even with RUST_LOG=trace

Note: these options are from Oracle Solaris and setting these options on a RHEL-based OS will not prevent DNS requests.

This is an example file: /etc/resolv.conf

search this.is.dumb dont.do.this unless.you.want your.queries.to.fail like.this
options retrans:3 retry:1
nameserver 8.8.8.8

aardvark-dns starts:

RUST_LOG=trace /usr/libexec/podman/aardvark-dns --config /run/containers/networks/custom-dns -p 4343 run

ps aux
root        6587  0.0  0.0 276552   220 ?        Ssl  17:25   0:00 /usr/libexec/podman/aardvark-dns --config /run/containers/networks/backup-dns -p 4343 run

However, it does not respond to any queries:

dig @127.0.0.1 -p 4343 google.com

; <<>> DiG 9.16.23-RH <<>> @127.0.0.1 -p 4343 google.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

No errors or anything about it found in syslog:

cat /var/log/messages | grep dns

But shows other logs from previous testing, for example:
aardvark-dns[5506]: Unable to start server unable to start CoreDns server: Cannot assign requested address (os error 99)
aardvark-dns[5758]: Unable to start server unable to start CoreDns server: Address already in use (os error 98)

If you remove the bogous options from the /etc/resolv.conf file it works again. E.g. with this /etc/resolv.conf it will respond to queries as expected:

search this.is.dumb dont.do.this unless.you.want your.queries.to.fail like.this
nameserver 8.8.8.8

Tested: aardvark-dns 1.7.0 (Podman package RHEL-based) aardvark-dns 1.9.0 (Github Releases)

baude commented 10 months ago

in some ways, a strong argument could be made that it is behaving as designed ... but it would be nice to be more graceful. @aleksanderdidriksen are you interested in creating a PR?