refactor(networking): harden networkmanager systemd services
This commit is contained in:
parent
f450885e01
commit
76381b19c5
2 changed files with 70 additions and 11 deletions
|
@ -5,6 +5,34 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
systemd.services.NetworkManager-dispatcher.serviceConfig = {
|
||||
ProtectClock = true; # Prevents the service from changing the system time or timezone.
|
||||
ProtectKernelTunables = true; # Restricts the service's ability to modify kernel parameters via sysctl.
|
||||
ProtectKernelModules = true; # Prevents the service from loading or unloading kernel modules.
|
||||
ProtectKernelLogs = true; # Prevents the service from reading kernel logs directly.
|
||||
SystemCallFilter = "~@clock @cpu-emulation @debug @obsolete @module @mount @raw-io @reboot @swap"; # Whitelists system calls, blocking all others based on specified groups.
|
||||
ProtectControlGroups = true; # Prevents the service from joining or modifying control groups other than its own.
|
||||
RestrictNamespaces = true; # Enforces stricter namespace isolation, preventing user namespace creation/joining.
|
||||
LockPersonality = true; # Disables the `personality()` system call, preventing execution domain changes.
|
||||
MemoryDenyWriteExecute = true; # Prevents the service from mapping memory pages as both writable and executable (W^X).
|
||||
RestrictRealtime = true; # Prevents the service from using real-time scheduling policies.
|
||||
RestrictSUIDSGID = true; # Prevents the service from utilizing setuid/setgid functionality.
|
||||
};
|
||||
|
||||
systemd.services.NetworkManager.serviceConfig = {
|
||||
ProtectClock = true; # Prevents the service from changing the system time or timezone.
|
||||
ProtectKernelTunables = true; # Restricts the service's ability to modify kernel parameters via sysctl.
|
||||
ProtectKernelModules = true; # Prevents the service from loading or unloading kernel modules.
|
||||
ProtectKernelLogs = true; # Prevents the service from reading kernel logs directly.
|
||||
SystemCallFilter = "~@clock @cpu-emulation @debug @obsolete @module @mount @raw-io @reboot @swap"; # Whitelists system calls, blocking all others based on specified groups.
|
||||
ProtectControlGroups = true; # Prevents the service from joining or modifying control groups other than its own.
|
||||
RestrictNamespaces = true; # Enforces stricter namespace isolation, preventing user namespace creation/joining.
|
||||
LockPersonality = true; # Disables the `personality()` system call, preventing execution domain changes.
|
||||
MemoryDenyWriteExecute = true; # Prevents the service from mapping memory pages as both writable and executable (W^X).
|
||||
RestrictRealtime = true; # Prevents the service from using real-time scheduling policies.
|
||||
RestrictSUIDSGID = true; # Prevents the service from utilizing setuid/setgid functionality.
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = hostname;
|
||||
useDHCP = lib.mkDefault true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue