diff options
| author | Dawid Dziurla <dawidd0811@gmail.com> | 2024-11-13 11:56:12 +0100 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2024-11-16 08:21:45 +0000 |
| commit | f66eb7c65a53396f964179b25e2f6f53b2b0577f (patch) | |
| tree | 957249a998c2713d63967c484497e01b3af643fb | |
| parent | [Backport release-24.11] remarshal_0_17: remove updateScript, add no auto upd... (diff) | |
| download | nixpkgs-f66eb7c65a53396f964179b25e2f6f53b2b0577f.tar.gz | |
nixos/incus: add incus-user service and socket
(cherry picked from commit ea9923c62f04285b1fdb4c80d65c7d4913661c12)
| -rw-r--r-- | nixos/doc/manual/release-notes/rl-2411.section.md | 2 | ||||
| -rw-r--r-- | nixos/modules/virtualisation/incus.nix | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 9efe085235aa..5c658ace8090 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -871,6 +871,8 @@ - `qgis` and `qgis-ltr` are now built without `grass` by default. `grass` support can be enabled with `qgis.override { withGrass = true; }`. +- `virtualisation.incus` module gained new `incus-user.service` and `incus-user.socket` systemd units. It is now possible to add a user to `incus` group instead of `incus-admin` for increased security. + ## Detailed Migration Information {#sec-release-24.11-migration} ### `sound` options removal {#sec-release-24.11-migration-sound} diff --git a/nixos/modules/virtualisation/incus.nix b/nixos/modules/virtualisation/incus.nix index 777e3b28f200..aa2102f49f0d 100644 --- a/nixos/modules/virtualisation/incus.nix +++ b/nixos/modules/virtualisation/incus.nix @@ -153,7 +153,10 @@ in Users in the "incus-admin" group can interact with the daemon (e.g. to start or stop containers) using the - {command}`incus` command line tool, among others + {command}`incus` command line tool, among others. + Users in the "incus" group can also interact with + the daemon, but with lower permissions + (i.e. administrative operations are forbidden). ''; package = lib.mkPackageOption pkgs "incus-lts" { }; @@ -359,6 +362,27 @@ in }; }; + systemd.services.incus-user = { + description = "Incus Container and Virtual Machine Management User Daemon"; + + inherit environment; + + after = [ + "incus.service" + "incus-user.socket" + ]; + + requires = [ + "incus-user.socket" + ]; + + serviceConfig = { + ExecStart = "${cfg.package}/bin/incus-user --group incus"; + + Restart = "on-failure"; + }; + }; + systemd.services.incus-startup = lib.mkIf cfg.softDaemonRestart { description = "Incus Instances Startup/Shutdown"; @@ -391,6 +415,17 @@ in }; }; + systemd.sockets.incus-user = { + description = "Incus user UNIX socket"; + wantedBy = [ "sockets.target" ]; + + socketConfig = { + ListenStream = "/var/lib/incus/unix.socket.user"; + SocketMode = "0660"; + SocketGroup = "incus"; + }; + }; + systemd.services.incus-preseed = lib.mkIf (cfg.preseed != null) { description = "Incus initialization with preseed file"; @@ -409,6 +444,7 @@ in }; }; + users.groups.incus = { }; users.groups.incus-admin = { }; users.users.root = { |
