summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Yakovlev <gyakovlev@gentoo.org>2021-11-01 16:33:10 -0700
committerGeorgy Yakovlev <gyakovlev@gentoo.org>2021-11-06 22:26:12 -0700
commitc897165ab00b566f2a21db3bb1d8da0fee67bfc8 (patch)
tree72309657c1eee8c4471b2de5c40cb71edf7eb555 /sys-apps/systemd/files
parentprofiles/arch/powerpc/ppc64: unmask systemd[hostnamed-fallback] (diff)
downloadgentoo-c897165ab00b566f2a21db3bb1d8da0fee67bfc8.tar.gz
gentoo-c897165ab00b566f2a21db3bb1d8da0fee67bfc8.tar.bz2
gentoo-c897165ab00b566f2a21db3bb1d8da0fee67bfc8.zip
sys-apps/systemd: add hostnamed-fallback mode
this will allow networkd/hostnamed to properly set hostname on systems without polkit. while it's possible to set hostname/fqdn manually already, with fallback workaround it will be possible to get hostnames from DHCP via networkd too without using polkit->spidermonkey->rust->llvm chain of deps. ideas and configs taken from yocto/oe https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=3dc37c12c17d5bb6d4701a425a4f79f6e31784ee https://github.com/systemd/systemd/issues/13501 Closes: https://github.com/gentoo/gentoo/pull/22792 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
Diffstat (limited to 'sys-apps/systemd/files')
-rw-r--r--sys-apps/systemd/files/00-hostnamed-network-user.conf6
-rw-r--r--sys-apps/systemd/files/org.freedesktop.hostname1_no_polkit.conf11
2 files changed, 17 insertions, 0 deletions
diff --git a/sys-apps/systemd/files/00-hostnamed-network-user.conf b/sys-apps/systemd/files/00-hostnamed-network-user.conf
new file mode 100644
index 000000000000..6b224ba9b937
--- /dev/null
+++ b/sys-apps/systemd/files/00-hostnamed-network-user.conf
@@ -0,0 +1,6 @@
+[Service]
+# By running with these options instead of root, networkd is allowed to request
+# a hostname change via DBUS when policykit is not present
+User=systemd-network
+Group=systemd-hostname
+AmbientCapabilities=CAP_SYS_ADMIN
diff --git a/sys-apps/systemd/files/org.freedesktop.hostname1_no_polkit.conf b/sys-apps/systemd/files/org.freedesktop.hostname1_no_polkit.conf
new file mode 100644
index 000000000000..f4d0271cdb6a
--- /dev/null
+++ b/sys-apps/systemd/files/org.freedesktop.hostname1_no_polkit.conf
@@ -0,0 +1,11 @@
+<?xml version="1.0"?> <!--*-nxml-*-->
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+ <policy group="systemd-hostname">
+ <allow own="org.freedesktop.hostname1"/>
+ <allow send_destination="org.freedesktop.hostname1"/>
+ <allow receive_sender="org.freedesktop.hostname1"/>
+ </policy>
+</busconfig>