summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Saunders <ben.e.saunders@gmail.com>2024-12-03 17:54:10 -0800
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2025-04-08 15:32:02 +0000
commit5f872dceb6ca6b3fa53c7af74be39e5132260401 (patch)
tree2590d3a25e1cf5d344e888b55ef6366e8b768b79
parent[release-24.11] authentik,authentik.outposts.{ldap,radius}: 2024.12.1 -> 2024... (diff)
downloadnixpkgs-origin/backport-361627-to-release-24.11.tar.gz
nixos/immich: restrict filesystem permissionsorigin/backport-361627-to-release-24.11
immich appears to create this directory with permissions 0755 by default, which needlessly exposes user data to other processes. (cherry picked from commit fd21ef2a65f341bbcfb0b26b4daf0ccb3ea59330)
-rw-r--r--nixos/modules/services/web-apps/immich.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/services/web-apps/immich.nix b/nixos/modules/services/web-apps/immich.nix
index b81e27d245f5..fa80c47305ba 100644
--- a/nixos/modules/services/web-apps/immich.nix
+++ b/nixos/modules/services/web-apps/immich.nix
@@ -37,6 +37,7 @@ let
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
+ UMask = "0077";
};
inherit (lib)
types
@@ -353,6 +354,21 @@ in
};
};
+ systemd.tmpfiles.settings = {
+ immich = {
+ # Redundant to the `UMask` service config setting on new installs, but installs made in
+ # early 24.11 created world-readable media storage by default, which is a privacy risk. This
+ # fixes those installs.
+ "${cfg.mediaLocation}" = {
+ e = {
+ user = cfg.user;
+ group = cfg.group;
+ mode = "0700";
+ };
+ };
+ };
+ };
+
users.users = mkIf (cfg.user == "immich") {
immich = {
name = "immich";