From e8c0de91271331ddbae872de63d0a267d4f71e12 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 18 Nov 2016 16:17:01 +0100 Subject: hostnamed: allow networkd to set the transient hostname systemd-networkd runs as user "systemd-network" and thus is not privileged to set the transient hostname: systemd-networkd[516]: ens3: Could not set hostname: Interactive authentication required. Standard polkit *.policy files do not have a syntax for granting privileges to a user, so ship a pklocalauthority (for polkit < 106) and a JavaScript rules file (for polkit >= 106) that grants the "systemd-network" system user that privilege. Add DnsmasqClientTest.test_transient_hostname() test to networkd-test.py to cover this. Make do_test() a bit more flexible by interpreting "coldplug==None" as "test sets up the interface by itself". Change DnsmasqClientTest to set up test_eth42 with a fixed MAC address so that we can configure dnsmasq to send a special host name for that. Fixes #4646 --- Makefile.am | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index 47c2ec8a8d..10ce363347 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,6 +55,8 @@ pamconfdir=@pamconfdir@ pkgconfigdatadir=$(datadir)/pkgconfig pkgconfiglibdir=$(libdir)/pkgconfig polkitpolicydir=$(datadir)/polkit-1/actions +polkitrulesdir=$(datadir)/polkit-1/rules.d +polkitpkladir=$(localstatedir)/lib/polkit-1/localauthority/10-vendor.d bashcompletiondir=@bashcompletiondir@ zshcompletiondir=@zshcompletiondir@ rpmmacrosdir=$(prefix)/lib/rpm/macros.d @@ -116,6 +118,8 @@ pkgconfiglib_DATA = polkitpolicy_in_in_files = polkitpolicy_in_files = polkitpolicy_files = +polkitrules_files = +polkitpkla_files = dist_udevrules_DATA = nodist_udevrules_DATA = dist_pkgsysconf_DATA = @@ -4836,8 +4840,16 @@ endif polkitpolicy_in_files += \ src/hostname/org.freedesktop.hostname1.policy.in +polkitrules_files += \ + src/hostname/systemd-networkd-hostname.rules + +polkitpkla_files += \ + src/hostname/systemd-networkd-hostname.pkla + EXTRA_DIST += \ - units/systemd-hostnamed.service.in + units/systemd-hostnamed.service.in \ + src/hostname/systemd-networkd-hostname.rules \ + src/hostname/systemd-networkd-hostname.pkla # ------------------------------------------------------------------------------ dist_systemunit_DATA_busnames += \ @@ -6189,6 +6201,8 @@ if ENABLE_POLKIT nodist_polkitpolicy_DATA = \ $(polkitpolicy_files) \ $(polkitpolicy_in_in_files:.policy.in.in=.policy) +polkitrules_DATA = $(polkitrules_files) +polkitpkla_DATA = $(polkitpkla_files) endif EXTRA_DIST += \ -- cgit v1.2.3-54-g00ecf