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

DNS: add 9.9.9.9 to resolv.conf #518

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

DNS: add 9.9.9.9 to resolv.conf #518

wants to merge 1 commit into from

Conversation

missytake
Copy link
Contributor

According to #515, some providers misconfigure /etc/resolv.conf. With 9.9.9.9, at least one working DNS resolver is there.

@missytake missytake requested a review from link2xt March 11, 2025 11:00
@link2xt
Copy link
Contributor

link2xt commented Mar 11, 2025

How does this interact with installing unbound? We are installing our own resolver on 127.0.0.1 that does DNSSEC checks only to add 9.9.9.9 next to it and send plaintext requests there?

@missytake
Copy link
Contributor Author

How does this interact with installing unbound? We are installing our own resolver on 127.0.0.1 that does DNSSEC checks only to add 9.9.9.9 next to it and send plaintext requests there?

Let me re-run the CI to double-check, but I assume that the unbound installation overwrites /etc/resolv.conf again and our temporary addition of 9.9.9.9 gets removed as soon as we don't need it anymore

@missytake
Copy link
Contributor Author

How does this interact with installing unbound? We are installing our own resolver on 127.0.0.1 that does DNSSEC checks only to add 9.9.9.9 next to it and send plaintext requests there?

Let me re-run the CI to double-check, but I assume that the unbound installation overwrites /etc/resolv.conf again and our temporary addition of 9.9.9.9 gets removed as soon as we don't need it anymore

The assumption was correct:

$ ssh staging2.testrun.org cat /etc/resolv.conf  # after adding 9.9.9.9, before the install unbound step
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.

nameserver 2a01:4ff:ff00::add:2
nameserver 2a01:4ff:ff00::add:1
nameserver 185.12.64.1
nameserver 9.9.9.9
$ ssh staging2.testrun.org cat /etc/resolv.conf  # after the unbound installation
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.

nameserver 2a01:4ff:ff00::add:2
nameserver 2a01:4ff:ff00::add:1
nameserver 185.12.64.1

@missytake
Copy link
Contributor Author

(I'll run a second deploy on staging2.testrun.org to make sure 9.9.9.9 isn't re-added on future runs, when unbound isn't installed freshly)

@feld
Copy link
Collaborator

feld commented Mar 11, 2025

My only advice is that if you append the DNS server to the end of the resolv.conf it will still slow down a lot of operations when there are broken DNS servers because glibc will try the DNS servers in the resolv.conf in order, but it is hardcoded to try the server 5 times with a 5 second timeout [1]. This means each failure requires you to wait 25 seconds per broken DNS server.

The cmdeploy will check for 4 DNS records early (A, AAAA, mta-sts CNAME, www CNAME) so the deployment is slowed down by at least 100 seconds just for this operation, not including the DNS lookups required to install packages.

[1] https://github.com/bminor/glibc/blob/master/resolv/resolv.h#L68-L73

@link2xt
Copy link
Contributor

link2xt commented Mar 11, 2025

@missytake But this still looks broken, requests should go to 127.0.0.1, not some 185.12.64.1 :/

On hetzner this also looks like this:

# cat /etc/resolv.conf
### Hetzner Online GmbH installimage
# nameserver config
nameserver 127.0.0.1
nameserver 185.12.64.2
nameserver 2a01:4ff:ff00::add:1
nameserver 185.12.64.1
nameserver 2a01:4ff:ff00::add:2

Not something that we actually want, it should only go to 127.0.0.1.

@missytake
Copy link
Contributor Author

If we write "nameserver 127.0.0.1" to /etc/resolvconf/resolv.conf.d/base after installing unbound, this doesn't make all the other entries disappear, right? I wonder what adds them.

@feld
Copy link
Collaborator

feld commented Mar 11, 2025

systemd has overcomplicated all of this, sadly

One of the most important comments in this doc:

To improve compatibility, /etc/resolv.conf is read in order to discover configured system DNS servers, but only if it is not a symlink to /run/systemd/resolve/stub-resolv.conf, /usr/lib/systemd/resolv.conf or /run/systemd/resolve/resolv.conf (see below).

https://www.freedesktop.org/software/systemd/man/latest/systemd-resolved.service.html

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 this pull request may close these issues.

None yet

4 participants