diff options
author | Kevin Cox <kevincox@kevincox.ca> | 2020-10-20 16:44:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 16:44:32 -0400 |
commit | e25cd7827e8ba24d50bdc9e69b63d8239099ec6d (patch) | |
tree | b20afb926f8988b29a2c7330cb23edfa11c8c312 /nixos | |
parent | 7d9979ec1bed86e97038a2de58ae253e9fc9469f (diff) | |
parent | 4e51247318f1f28d79d0f85e26ddbe17918c97e4 (diff) |
Merge pull request #98176 from minijackson/jellyfin-systemd-security
nixos/jellyfin: add some systemd security options
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/jellyfin.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/jellyfin.nix b/nixos/modules/services/misc/jellyfin.nix index 0493dadea94e..6a47dc3628f4 100644 --- a/nixos/modules/services/misc/jellyfin.nix +++ b/nixos/modules/services/misc/jellyfin.nix @@ -45,6 +45,46 @@ in CacheDirectory = "jellyfin"; ExecStart = "${cfg.package}/bin/jellyfin --datadir '/var/lib/${StateDirectory}' --cachedir '/var/cache/${CacheDirectory}'"; Restart = "on-failure"; + + # Security options: + + NoNewPrivileges = true; + + AmbientCapabilities = ""; + CapabilityBoundingSet = ""; + + # ProtectClock= adds DeviceAllow=char-rtc r + DeviceAllow = ""; + + LockPersonality = true; + + PrivateTmp = true; + PrivateDevices = true; + PrivateUsers = true; + + ProtectClock = true; + ProtectControlGroups = true; + ProtectHostname = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + + RemoveIPC = true; + + RestrictNamespaces = true; + # AF_NETLINK needed because Jellyfin monitors the network connection + RestrictAddressFamilies = [ "AF_NETLINK" "AF_INET" "AF_INET6" ]; + RestrictRealtime = true; + RestrictSUIDSGID = true; + + SystemCallArchitectures = "native"; + SystemCallErrorNumber = "EPERM"; + SystemCallFilter = [ + "@system-service" + + "~@chown" "~@cpu-emulation" "~@debug" "~@keyring" "~@memlock" "~@module" + "~@obsolete" "~@privileged" "~@setuid" + ]; }; }; |