# Hardening, mostly the KSPP recommendations that Talos also sets by default. # Left out on purpose: user.max_user_namespaces=0 breaks podman in jobs, and kernel.modules_disabled=1 # breaks loading the network modules podman needs. # Hide kernel addresses in /proc and logs, even from root; they help exploits bypass KASLR. kernel.kptr_restrict = 2 # Only root may read the kernel log (it leaks addresses and hardware details). kernel.dmesg_restrict = 1 # No perf events for non-root users. Upstream kernels treat 3 like 2 (the strictest they know). kernel.perf_event_paranoid = 3 # Harden the BPF JIT against JIT spraying, for every user. Small cost when BPF is used. net.core.bpf_jit_harden = 2 # No BPF for non-root users, and it can't be switched back on at runtime (Fedora's default 2 can). kernel.unprivileged_bpf_disabled = 1 # No kexec: nobody can boot another kernel without going through Secure Boot. kernel.kexec_load_disabled = 1 # No core dumps of setuid programs; they can contain secrets. fs.suid_dumpable = 0 # Don't load TTY line disciplines on demand; old ones have had exploitable bugs. dev.tty.ldisc_autoload = 0 # userfaultfd only for root; it is used to make kernel race exploits reliable. vm.unprivileged_userfaultfd = 0 # Don't open FIFOs and regular files owned by someone else in sticky directories like /tmp. fs.protected_fifos = 2 fs.protected_regular = 2 # A process may only ptrace its own descendants (gdb ./prog works, gdb -p doesn't). kernel.yama.ptrace_scope = 1 # Performance: Fedora allows 128 inotify instances per user. Many containers (file watchers, # systemd inside containers) run out of those; 8192 is common on Kubernetes nodes. fs.inotify.max_user_instances = 8192