-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
RFC: resolved: add option to toggle DNS search on hostdomain #22868
Conversation
84fc834
to
406cbee
Compare
If the domain list is empty, since systemd@c1a0727 resolved has been adding a `search .` line to `resolv.conf` in order to ensure the FQDN of the host does not imply a DNS search domain. In some cases it may be desirable however to enable this behavior. In such a case the `search .` line should not be written to `resolv.conf`. This commit adds a `SearchHostDomain=` option to resolved's configuration that can be used toggle this behavior. Defaults to `no`. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1874419
406cbee
to
deb9300
Compare
What's the usecase? If you manually reconfigure resolved like this, why not just add the search domain instead? Not grokking this? |
The specific need is to get rid of this ugly hack in OKD (OpenShift on Fedora CoreOS): https://github.com/openshift/okd-machine-os/blob/5686ca6a95b95437e70c79d9c72cbcdadd736f3e/overlay.d/99okd/usr/lib/systemd/system/fix-resolv-conf-search.service There was a whole saga surrounding this, i.e. making DNS work in OKD with resolved and NM in tandem, but I'm not too familiar with the details. AFAICT something adds the correct search domain to CC'ing some folks who were involved and/or might be able to explain this issue better than me: @fortinj66 @vrutkovs @dustymabe |
<varlistentry> | ||
<term><varname>SearchHostDomain=</varname></term> | ||
<listitem><para>Takes a boolean argument. If <literal>no</literal> (the default), <command>systemd-resolved</command> will add | ||
the line <emphasis>search .</emphasis> to <filename>/etc/systemd/resolved.conf</filename>. If <literal>yes</literal>, a search |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the line <emphasis>search .</emphasis> to <filename>/etc/systemd/resolved.conf</filename>. If <literal>yes</literal>, a search | |
the line <emphasis>search .</emphasis> to <filename>/run/systemd/resolve/stub-resolv.conf</filename>. If <literal>yes</literal>, a search |
This PR description has a bit more reasoning in it: openshift/okd-machine-os#158 Maybe this means my above assertion is wrong and the correct search domain isn't added to resolv.conf after all in either case - it just breaks for us when |
Why doesn't openshift install the search domain it wants explicitly? relying on the obscure logic of glibc to derive one search domain off the hostname if it is set to an fqdn and no search domain otherwise configured is just super duper weird. It falls apart as soon as people set manual search domains anyway, as the logic is disabled in glibc then anyway. Seriously, fix openshift on this. if you want a search domain configure a search domain like everyone else. |
Ok, I think that's fair. What would be the right way to set the search domain with resolved programmatically? Do I just append a line with |
that really depends on where the DNS config comes from in general. DHCP? static global config? per-network networkd .network files? programmatically via NM? |
It could be from DHCP or static global, via NM. |
Adding some more context provided by @fortinj66 over at openshift/okd-machine-os#328 (comment):
UPI stands for User Provisioned Infrastructure (i.e. bring your own machines). I guess we can focus on this case for now. If there's a preferred way to set the search domain in such a case, please let me know. Edit: I'll leave this PR open for now for this discussion. Please feel free to close if that's not wanted. |
Sorry, I can't parse this. Note I have no clue about OpenShift or "fcos"? Anyway, there's nothing left to fix here? instead maybe post an issue on "fcos" (for whatever that is) or OpenShift? |
My bad, I'm confused by this myself. FCOS stands for Fedora CoreOS (the rpm-ostree based distro). The machine is provisioned with static ip and hostname, which are both passed in through the The question now is how to either |
Note that this is the code which results in the current behavior. Prior to this change "it just worked" |
@LorbusChris it sounds strange to me to rely on that behaviour. We could probably add a feature in resolved to pick up DNS config from the kernel cmdline. Given that networkd already picks up IP config from there, it would only be natural to pick it up from there too. or in other words, you then could add Would that work? |
As long as that would prevent the The issue really is the added |
@poettering a |
can you file an RFE issue requesting that please? |
Hmm? that's really no the issue here. What I am suggesting here is that openshift should set the DNS search list explicitly, instead of relying of weird automatic logic of glibc to derive a search domain for the host's hostname if it is set to an fqdn and no search domains are explicitly configured. Hence, if we had a new kernel cmdline option you'd just add the search domain there directly, and not have to rely on that. And everything would be dandy, since you don#t rely on automatisms that will break once someone configures a manual search domain somewhere. |
will do. |
Filed #24103 |
If the domain list is empty, since c1a0727
resolved has been adding a
search .
line toresolv.conf
in order toensure the FQDN of the host does not imply a DNS search domain.
In some cases it may be desirable however to enable this behavior.
In such a case the
search .
line should not be written toresolv.conf
.This commit adds a
SearchHostDomain=
option to resolved'sconfiguration that can be used toggle this behavior. Defaults to
no
.Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1874419
Beware: This is an untested Friday afternoon PR. Only RFC on this approach at this time.