grimm-nixos-laptop/hardening/systemd/acpid.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

2025-01-05 23:03:11 +01:00
{ lib, config, ... }:
{
config.systemd.services = lib.mkIf (config.specialisation != { }) {
acpid.serviceConfig = {
CapabilityBoundingSet = [
2025-01-07 11:31:43 +01:00
""
];
2025-01-05 23:03:11 +01:00
NoNewPrivileges = true;
2025-01-28 23:59:41 +01:00
RestrictNamespaces = [
"~pid"
"~user"
"~net"
"~uts"
"~mnt"
"~cgroup"
"~ipc"
];
2025-01-05 23:03:11 +01:00
ProtectControlGroups = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
MemoryDenyWriteExecute = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
SystemCallFilter = "@system-service";
LockPersonality = true;
2025-01-28 23:59:41 +01:00
ProtectSystem = "strict";
2025-01-07 11:31:43 +01:00
PrivateUsers = true;
RestrictRealtime = true;
2025-01-28 23:59:41 +01:00
PrivateTmp = true;
ProtectHome = true;
ProtectProc = "invisible";
ProtectKernelLogs = true;
2025-01-07 11:31:43 +01:00
IPAddressAllow = [ ];
2025-01-28 23:59:41 +01:00
PrivateDevices = false; # acpi obviously needs device access
PrivateNetwork = false; # required for netlink to work properly
RestrictAddressFamilies = [
"AF_NETLINK"
"AF_UNIX"
];
2025-01-05 23:03:11 +01:00
};
};
}