summaryrefslogtreecommitdiffstats
path: root/nixos/modules/profiles
diff options
context:
space:
mode:
authorTamara Schmitz <tamara.zoe.schmitz@posteo.de>2023-12-20 01:38:07 +0100
committerTamara Schmitz <tamara.zoe.schmitz@posteo.de>2024-01-27 20:43:58 +0000
commitb80c3284d5d2a7282272e764e3c48bccccdbadcb (patch)
tree659888bc31fbf2670774b6da3737d1a677654e6b /nixos/modules/profiles
parent30b34ac00788d0dce98a992b6d92779b9eb6bc19 (diff)
nixos/hardened: update hardened profile to new recommendations
Borrowing from here to match hardened profile with more recent kernels: * https://madaidans-insecurities.github.io/guides/linux-hardening.html?#boot-parameters * https://github.com/a13xp0p0v/kernel-hardening-checker/ Removed "slub_debug" as that option disables kernel memory address hashing. You also see a big warning about this in the dmesg: "This system shows unhashed kernel memory addresses via the console, logs, and other interfaces." "init_on_alloc=1" and "init_on_free=1" zeroes all SLAB and SLUB allocations. Introduced in 6471384af2a6530696fc0203bafe4de41a23c9ef. Also the default for the Android Google kernel btw. It is on by default through the KConfig. "slab_nomerge" prevents the merging of slab/slub caches. These are effectively slab/slub pools. "LEGACY_VSYSCALL_NONE" disables the older vsyscall mechanic that relies on static address. It got superseeded by vdsos a decade ago. Read some LWN.net to learn more ;) "debugfs=off" I'm sure there are some few userspace programs that rely on debugfs, but they shouldn't. Most other things mentioned on the blog where already the default on a running machine or may not be applicable. Most other Kconfigs changes come from the kernel hardening checker and were added, when they were not applied to the kernel already. Unsure about CONFIG_STATIC_USERMODEHELPER. Would need testing.
Diffstat (limited to 'nixos/modules/profiles')
-rw-r--r--nixos/modules/profiles/hardened.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/nixos/modules/profiles/hardened.nix b/nixos/modules/profiles/hardened.nix
index 74dc2cb1b9aa..b85a2ac7e69d 100644
--- a/nixos/modules/profiles/hardened.nix
+++ b/nixos/modules/profiles/hardened.nix
@@ -39,14 +39,17 @@ with lib;
security.apparmor.killUnconfinedConfinables = mkDefault true;
boot.kernelParams = [
- # Slab/slub sanity checks, redzoning, and poisoning
- "slub_debug=FZP"
+ # Don't merge slabs
+ "slab_nomerge"
- # Overwrite free'd memory
+ # Overwrite free'd pages
"page_poison=1"
# Enable page allocator randomization
"page_alloc.shuffle=1"
+
+ # Disable debugfs
+ "debugfs=off"
];
boot.blacklistedKernelModules = [