Skip to content

Commit

Permalink
nixos/immich: restrict filesystem permissions
Browse files Browse the repository at this point in the history
immich appears to create this directory with permissions 0755 by
default, which needlessly exposes user data to other processes.
  • Loading branch information
Ralith committed Dec 8, 2024
1 parent ee5452c commit 8efc344
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nixos/modules/services/web-apps/immich.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ let
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
UMask = "0077";
};
inherit (lib)
types
Expand Down Expand Up @@ -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}" = {
d = {
user = cfg.user;
group = cfg.group;
mode = "0700";
};
};
};
};

users.users = mkIf (cfg.user == "immich") {
immich = {
name = "immich";
Expand Down

0 comments on commit 8efc344

Please sign in to comment.