3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules
Vincent Haupert 3cf9508c72 nixos/github-runner: refactor tokens handling
This commit changes how we deal with the current token, i.e., the token
which may exist from a previous runner registration, and the configured
token, i.e., the path set for the respective NixOS configuration option.

Until now, we copied the configured and the current token (if any) to
the runtime directory to compare them. The path of the current token may
reference a file which is only accessible to specific users (even only
root). Therefore, we ran the copying of credentials with elevated
privileges by prefixing the `ExecStartPre=` script with a `+` (see
systemd.service(5)). In this script, we also changed the owner of the
files to the service user. Apparently, however, the user/group pair
sometimes did not exist because we use `DynamicUser=`.

To address this issue, we no longer change the owner of the file.
Instead, we change the file permissions to 0666 to allow the runner
configuration script (runs with full sandboxing) to read-write the file.
Due to the current permissions of the runtime directory (0755), this
would expose the token. Therefore, we process the tokens in the state
directory, which is only accessible to the service user.

If a new token file exists in the state directory, the configuration
script should trigger a new runner registration. Afterward, it deletes
the new token file. The token is still available using the path of the
current token which is inaccessible within the service's sandbox.
2021-12-01 16:15:43 +01:00
..
config nixos/swap: remove fallocate and use dd as the main swap creation method 2021-11-13 17:49:42 +02:00
hardware nixos/nvidia: check modesetting for gdm-wayland only when gdm is enabled 2021-11-30 16:06:21 +01:00
i18n/input-method nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
installer nixos/installer: Quote variable references 2021-11-26 18:58:08 +13:00
misc Merge pull request #146345 from SuperSandro2000/locate-pruneBindMounts 2021-11-30 21:16:25 +01:00
profiles Merge pull request #146288 from Artturin/mtoolsandsuch 2021-11-19 00:21:08 +02:00
programs Merge pull request #142839 from ivan/zsh-autosuggestions-config-async 2021-11-25 00:09:18 +01:00
security nixos/acme: fix typo in docs 2021-11-30 21:31:50 +08:00
services nixos/github-runner: refactor tokens handling 2021-12-01 16:15:43 +01:00
system Merge pull request #144094 from hercules-ci/nixos-specialisations-use-extendModules 2021-12-01 11:03:36 +01:00
tasks Merge pull request #146709 from Artturin/underscorename 2021-11-21 03:12:31 +02:00
testing nixos/lib/qemu-flags: rename to qemu-common 2021-09-18 16:58:16 +02:00
virtualisation Merge pull request #140992 from hercules-ci/aarch64-amis 2021-12-01 14:48:00 +01:00
module-list.nix nixos/webdav-server-rs: init 2021-11-30 10:19:14 +08:00
rename.nix Merge pull request #140820 from VergeDX/kippo-remove 2021-10-11 17:19:11 +08:00