tsuki/plex: harden systemd unit

This commit is contained in:
Oystein Kristoffer Tveit 2023-07-12 02:00:06 +02:00
parent 20de3c260f
commit c8db83b925
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 26 additions and 2 deletions

View File

@ -1,10 +1,34 @@
{ config, secrets, ... }: { config, secrets, ... }: let
{ cfg = config.services.plex;
in {
services.plex = { services.plex = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
dataDir = "${config.machineVars.dataDrives.default}/var/plex"; dataDir = "${config.machineVars.dataDrives.default}/var/plex";
}; };
systemd.services.plex.serviceConfig = {
ReadWritePaths = [ cfg.dataDir ];
NoNewPrivileges = true;
PrivateDevices = true;
ProtectClock = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
PrivateMounts = true;
RestrictSUIDSGID = true;
ProtectHostname = true;
LockPersonality = true;
ProtectKernelTunables = true;
ProtectSystem = "strict";
ProtectProc = true;
ProtectHome = true;
# PrivateNetwork = true;
PrivateUsers = true;
PrivateTmp = true;
UMask = "0007";
# RestrictAddressFamilies = [ "AF_UNIX AF_INET AF_INET6" ];
SystemCallArchitectures = "native";
};
# networking.firewall.allowedTCPPorts = [ secrets.ports.plex ]; # networking.firewall.allowedTCPPorts = [ secrets.ports.plex ];
} }