more sysd hardening
This commit is contained in:
parent
d6c70f5ae2
commit
8f68278465
4 changed files with 82 additions and 0 deletions
27
hardening/systemd/acpid.nix
Normal file
27
hardening/systemd/acpid.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
config.systemd.services = lib.mkIf (config.specialisation != { }) {
|
||||
acpid.serviceConfig = {
|
||||
CapabilityBoundingSet = [
|
||||
""
|
||||
];
|
||||
NoNewPrivileges = true;
|
||||
RestrictNamespaces = "pid";
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = "@system-service";
|
||||
LockPersonality = true;
|
||||
ProtectHostname=true;
|
||||
ProtectSystem=true;
|
||||
PrivateUsers=true;
|
||||
PrivateNetwork=true;
|
||||
RestrictRealtime=true;
|
||||
IPAddressAllow=[];
|
||||
RestrictAddressFamilies="AF_NETLINK AF_UNIX";
|
||||
};
|
||||
};
|
||||
}
|
24
hardening/systemd/auditd.nix
Normal file
24
hardening/systemd/auditd.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
config.systemd.services = lib.mkIf (config.specialisation != { }) {
|
||||
auditd.serviceConfig = {
|
||||
# CapabilityBoundingSet = [ "CAP_AUDIT_*" "CAP_SYSLOG" "CAP_SYS_NICE" "CAP_SYS_PACCT" "CAP_SYS_PTRACE" ];
|
||||
NoNewPrivileges = true;
|
||||
RestrictNamespaces = "pid";
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelModules = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = "@system-service";
|
||||
LockPersonality = true;
|
||||
ProtectHostname=true;
|
||||
ProtectSystem=true;
|
||||
# PrivateUsers=true;
|
||||
# PrivateNetwork=true;
|
||||
RestrictRealtime=true;
|
||||
IPAddressAllow=[];
|
||||
RestrictAddressFamilies="AF_NETLINK";
|
||||
};
|
||||
};
|
||||
}
|
28
hardening/systemd/cups.nix
Normal file
28
hardening/systemd/cups.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
config.systemd.services = lib.mkIf (config.specialisation != { }) {
|
||||
cups.serviceConfig = {
|
||||
#CapabilityBoundingSet = [
|
||||
# ""
|
||||
#];
|
||||
NoNewPrivileges = true;
|
||||
RestrictNamespaces = "pid";
|
||||
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = "@system-service";
|
||||
LockPersonality = true;
|
||||
ProtectHostname=true;
|
||||
RestrictRealtime=true;
|
||||
|
||||
# PrivateUsers=true;
|
||||
# PrivateNetwork=true;
|
||||
# RestrictAddressFamilies="AF_UNIX";
|
||||
# ProtectSystem=true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -15,6 +15,9 @@ in
|
|||
imports = [
|
||||
./NetworkManager.nix
|
||||
./wpa_supplicant.nix
|
||||
./auditd.nix
|
||||
./acpid.nix
|
||||
./cups.nix
|
||||
];
|
||||
|
||||
options.systemd.services = lib.mkOption {
|
||||
|
|
Loading…
Reference in a new issue