diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-12-04 19:40:34 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-12-16 11:03:36 +0100 |
commit | 60e4fb4240b24bdd2d4299d8d844f48093df8807 (patch) | |
tree | 5309d6d2402443f62fc8b87e5b6fdf4bf410d1c6 /man/org.freedesktop.hostname1.xml | |
parent | d39079fcaa05e23540d2b1f0270fa31c22a7e9f1 (diff) | |
download | systemd-60e4fb4240b24bdd2d4299d8d844f48093df8807.tar.gz |
hostnamed,shared/hostname-setup: expose the origin of the current hostname
In hostnamed this is exposed as a dbus property, and in the logs in both
places.
This is of interest to network management software and such: if the fallback
hostname is used, it's not as useful as the real configured thing. Right now
various programs try to guess the source of hostname by looking at the string.
E.g. "localhost" is assumed to be not the real hostname, but "fedora" is. Any
such attempts are bound to fail, because we cannot distinguish "fedora" (a
fallback value set by a distro), from "fedora" (received from reverse dns),
from "fedora" read from /etc/hostname.
/run/systemd/fallback-hostname is written with the fallback hostname when
either pid1 or hostnamed sets the kernel hostname to the fallback value. Why
remember the fallback value and not the transient hostname in /run/hostname
instead?
We have three hostname types: "static", "transient", fallback".
– Distinguishing "static" is easy: the hostname that is set matches what
is in /etc/hostname.
– Distingiushing "transient" and "fallback" is not easy. And the
"transient" hostname may be set outside of pid1+hostnamed. In particular,
it may be set by container manager, some non-systemd tool in the initramfs,
or even by a direct call. All those mechanisms count as "transient". Trying
to get those cases to write /run/hostname is futile. It is much easier to
isolate the "fallback" case which is mostly under our control.
And since the file is only used as a flag to mark the hostname as fallback,
it can be hidden inside of our /run/systemd directory.
For https://bugzilla.redhat.com/show_bug.cgi?id=1892235.
Diffstat (limited to 'man/org.freedesktop.hostname1.xml')
-rw-r--r-- | man/org.freedesktop.hostname1.xml | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/man/org.freedesktop.hostname1.xml b/man/org.freedesktop.hostname1.xml index 8e5c37345d..a17339ad07 100644 --- a/man/org.freedesktop.hostname1.xml +++ b/man/org.freedesktop.hostname1.xml @@ -64,6 +64,7 @@ node /org/freedesktop/hostname1 { readonly s PrettyHostname = '...'; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly s FallbackHostname = '...'; + readonly s HostnameSource = '...'; readonly s IconName = '...'; readonly s Chassis = '...'; readonly s Deployment = '...'; @@ -117,6 +118,8 @@ node /org/freedesktop/hostname1 { <variablelist class="dbus-property" generated="True" extra-ref="FallbackHostname"/> + <variablelist class="dbus-property" generated="True" extra-ref="HostnameSource"/> + <variablelist class="dbus-property" generated="True" extra-ref="IconName"/> <variablelist class="dbus-property" generated="True" extra-ref="Chassis"/> @@ -171,6 +174,11 @@ node /org/freedesktop/hostname1 { <para>The <varname>FallbackHostname</varname> property exposes the fallback hostname (configured at compilation time).</para> + <para>The <varname>HostnameSource</varname> property exposes the origin of the currently configured + hostname. One of <literal>static</literal> (set from <filename>/etc/hostname</filename>), + <literal>transient</literal> (a non-permanent hostname from an external source), + <literal>fallback</literal> (the compiled-in fallback value).</para> + <para>The <varname>IconName</varname> property exposes the <emphasis>icon name</emphasis> following the XDG icon naming spec. If not set, information such as the chassis type (see below) is used to find a suitable fallback icon name (i.e. <literal>computer-laptop</literal> |