summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/games
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2023-10-18 18:01:35 +0200
committerYaya <github@uwu.is>2023-10-21 13:50:05 +0200
commitb11e3eb7d178db4c39482434b3b98562b26d8b14 (patch)
treed93d1e611c308f285332eb8e4050ddc18c4cc7bb /nixos/modules/services/games
parentbe1484aa1a980c5ab776be6fd62685de8498b584 (diff)
nixos/asf: update hardening options to match upstream
Diffstat (limited to 'nixos/modules/services/games')
-rw-r--r--nixos/modules/services/games/asf.nix22
1 files changed, 17 insertions, 5 deletions
diff --git a/nixos/modules/services/games/asf.nix b/nixos/modules/services/games/asf.nix
index f15d7077d965..432de6336ce2 100644
--- a/nixos/modules/services/games/asf.nix
+++ b/nixos/modules/services/games/asf.nix
@@ -187,29 +187,41 @@ in
Group = "asf";
WorkingDirectory = cfg.dataDir;
Type = "simple";
- ExecStart = "${cfg.package}/bin/ArchiSteamFarm --path ${cfg.dataDir} --process-required --no-restart --service --no-config-migrate";
+ ExecStart = "${lib.getExe cfg.package} --no-restart --process-required --service --system-required --path ${cfg.dataDir}";
Restart = "always";
- # mostly copied from the default systemd service
- PrivateTmp = true;
+ # copied from the default systemd service at
+ # https://github.com/JustArchiNET/ArchiSteamFarm/blob/main/ArchiSteamFarm/overlay/variant-base/linux/ArchiSteamFarm%40.service
+ CapabilityBoundingSet = "";
+ DevicePolicy = "closed";
LockPersonality = true;
+ NoNewPrivileges = true;
PrivateDevices = true;
PrivateIPC = true;
PrivateMounts = true;
+ PrivateTmp = true; # instead of rw /tmp
PrivateUsers = true;
+ ProcSubset = "pid";
ProtectClock = true;
ProtectControlGroups = true;
+ ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
- ProtectSystem = "full";
+ ProtectSystem = "strict";
RemoveIPC = true;
- RestrictAddressFamilies = "AF_INET AF_INET6";
+ RestrictAddressFamilies = "AF_INET AF_INET6 AF_NETLINK AF_UNIX";
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
+ SystemCallArchitectures = "native";
+ UMask = "0077";
+
+ # we luckily already have systemd v247+
+ SecureBits = "noroot-locked";
+ SystemCallFilter = [ "@system-service" "~@privileged" ];
}
];