mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
fix(systemd): sandbox privileged hardware oneshots
Assisted-by: DeepSeek Harness (deepseek-flash)
This commit is contained in:
1 parent
e0cb3eab75
commit
a97400df69
6 files changed
+82
-3
No files matched your search
@@ -42,6 +42,37 @@ rec {
|
||||
];
|
||||
};
|
||||
|
||||
# For short-lived root oneshots that perform one narrowly scoped privileged
|
||||
# operation. Callers add only the capabilities and device access they need.
|
||||
# ProtectKernelTunables is deliberately unset because it makes /sys read-only.
|
||||
privilegedOneshot = {
|
||||
AmbientCapabilities = "";
|
||||
CapabilityBoundingSet = "";
|
||||
LockPersonality = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
PrivateMounts = true;
|
||||
PrivateNetwork = true;
|
||||
PrivateTmp = true;
|
||||
ProcSubset = "pid";
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHome = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectProc = "invisible";
|
||||
ProtectSystem = "strict";
|
||||
RemoveIPC = true;
|
||||
RestrictAddressFamilies = [ "AF_UNIX" ];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
UMask = "0077";
|
||||
};
|
||||
|
||||
# Apply a preset at mkOptionDefault priority, so nixpkgs module values win.
|
||||
mkDefaults = lib.mapAttrs (_: lib.mkOptionDefault);
|
||||
}
|
||||
Reference in new issue
Block a user