diff options
author | Michael Weiss <dev.primeos@gmail.com> | 2020-06-21 16:25:50 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-07-11 00:05:41 +0200 |
commit | 483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7 (patch) | |
tree | b8128bf4fdadde57604b833a6c1e8483efb666a2 /nixos | |
parent | fa54dd346fe5e73d877f2068addf6372608c820b (diff) | |
download | nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.tar nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.tar.gz nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.tar.bz2 nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.tar.lz nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.tar.xz nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.tar.zst nixpkgs-483dbe92370ef6c4a1d6f96a3973bbca4b8ae3f7.zip |
systemd: Allow setting the transient hostname via DHCP
This permits using method_set_hostname but still denies method_set_static_hostname. As a result DHCP clients can now always set the transient hostname via the SetHostname method of the D-Bus interface of systemd-hostnamed (org.freedesktop.hostname1.set-hostname). If the NixOS option networking.hostName is set to an empty string (or "localhost") the static hostname (kernel.hostname but NOT /etc/hostname) will additionally be updated (this is intended). From "man hostnamectl": The transient hostname is a fallback value received from network configuration. If a static hostname is set, and is valid (something other than localhost), then the transient hostname is not used. Fix #74847. Note: It's possible to restrict access to the org.freedesktop.hostname1 interface using Polkit rules.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/systemd.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/tests/systemd.nix b/nixos/tests/systemd.nix index ca2e36a443e..24949c4a9f6 100644 --- a/nixos/tests/systemd.nix +++ b/nixos/tests/systemd.nix @@ -97,6 +97,11 @@ import ./make-test-python.nix ({ pkgs, ... }: { re.search(r"^Filesystem state: *clean$", extinfo, re.MULTILINE) is not None ), ("File system was not cleanly unmounted: " + extinfo) + # Regression test for https://github.com/NixOS/nixpkgs/pull/91232 + with subtest("setting transient hostnames works"): + machine.succeed("hostnamectl set-hostname --transient machine-transient") + machine.fail("hostnamectl set-hostname machine-all") + with subtest("systemd-shutdown works"): machine.shutdown() machine.wait_for_unit("multi-user.target") |