nixpkgs/nixos/modules/tasks
Florian Klink 3c74e48d9c nixos/filesystems: ensure keys gid on /run/keys mountpoint
boot.specialFileSystems is used to describe mount points to be set up in
stage 1 and 2.

We use it to create /run/keys already there, so sshd-in-initrd scenarios
can consume keys sent over through nixops send-keys.

However, it seems the kernel only supports the gid=… option for tmpfs,
not ramfs, causing /run/keys to be owned by the root group, not keys
group.

This was/is worked around in nixops by running a chown root:keys
/run/keys whenever pushing keys [1], and as machines had to have pushed keys
to be usable, this was pretty much always the case.

This is causing regressions in setups not provisioned via nixops, that
still use /run/keys for secrets (through cloud provider startup scripts
for example), as suddenly being an owner of the "keys" group isn't
enough to access the folder.

This PR removes the defunct gid=… option in the mount script called in
stage 1 and 2, and introduces a tmpfiles rule which takes care of fixing
up permissions as part of sysinit.target (very early in systemd bootup,
so before regular services are started).

In case of nixops deployments, this doesn't change anything.
nixops-based deployments receiving secrets from nixops send-keys in
initrd will simply have the permissions already set once tmpfiles is
started.

Fixes #42344

[1]: 884d6c3994/nixops/backends/__init__.py (L267-L269)
2020-02-05 01:53:26 +01:00
..
filesystems nfs: set up request-key for id mapping 2019-12-12 15:42:44 +00:00
auto-upgrade.nix NixOS/auto-upgrade: add gzip to service path 2019-09-15 16:13:29 +02:00
bcache.nix [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
cpu-freq.nix nixos/cpufreq: Remove the alias to set the cpu frequency governor 2019-01-03 20:57:49 +09:00
encrypted-devices.nix nixos/tasks/encrypted-devices: fix regression from #54637 2019-02-02 17:31:31 +01:00
filesystems.nix nixos/filesystems: ensure keys gid on /run/keys mountpoint 2020-02-05 01:53:26 +01:00
lvm.nix Don't enable LVM2 in containers 2014-04-15 23:43:39 +02:00
network-interfaces-scripted.nix treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
network-interfaces-systemd.nix nixos/networkd: only set gateway if it's explicitly specified in the module system 2019-12-08 03:30:04 +01:00
network-interfaces.nix nixos/networking-interfaces: change preferTempAddress to allow disabling temp addresses 2020-02-01 11:38:40 +01:00
powertop.nix nixos/powertop: wait for hardware to initialize 2020-01-09 19:45:41 +08:00
scsi-link-power-management.nix [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
swraid.nix systemd service: remove generator-packages option 2019-08-01 00:55:35 +03:00
trackpoint.nix trackpoint: Make the device name configurable 2018-08-06 02:56:32 +02:00
tty-backgrounds-combine.sh Another attempt to eradicate ensureDir 2014-06-30 14:56:10 +02:00