summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-21 18:24:51 +0100
committerGitHub <noreply@github.com>2016-11-21 18:24:51 +0100
commitc5066640a1a82bc74f538fe9d2ecc52ea81613b3 (patch)
treeb3e8d885fb1732adc318d17980ca856b06c28ea3 /src
parent270f419316758162bfead87608cbaeeb4fd6987e (diff)
parent89748b0af1aeed4126a6faaf493f7be7230c804a (diff)
Merge pull request #4701 from martinpitt/networkd-polkit
hostnamed: allow networkd to set the transient hostname
Diffstat (limited to 'src')
-rw-r--r--src/hostname/systemd-networkd-hostname.pkla4
-rw-r--r--src/hostname/systemd-networkd-hostname.rules5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/hostname/systemd-networkd-hostname.pkla b/src/hostname/systemd-networkd-hostname.pkla
new file mode 100644
index 0000000000..345ce617c6
--- /dev/null
+++ b/src/hostname/systemd-networkd-hostname.pkla
@@ -0,0 +1,4 @@
+[Allow systemd-networkd to set transient hostname]
+Identity=unix-user:systemd-network
+Action=org.freedesktop.hostname1.set-hostname
+ResultAny=yes
diff --git a/src/hostname/systemd-networkd-hostname.rules b/src/hostname/systemd-networkd-hostname.rules
new file mode 100644
index 0000000000..b7b780da9e
--- /dev/null
+++ b/src/hostname/systemd-networkd-hostname.rules
@@ -0,0 +1,5 @@
+polkit.addRule(function(action, subject) {
+ if (action.id == "org.freedesktop.hostname1.set-hostname" && subject.user == "systemd-network") {
+ return polkit.Result.YES;
+ }
+});