Skip to content

Commit

Permalink
nixos/immich: restrict media filesystem permissions (#361627)
Browse files Browse the repository at this point in the history
  • Loading branch information
dotlambda authored Dec 11, 2024
2 parents a0025be + fd21ef2 commit d55cc46
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}" = {
e = {
user = cfg.user;
group = cfg.group;
mode = "0700";
};
};
};
};

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

0 comments on commit d55cc46

Please sign in to comment.