32 lines
1.4 KiB
Plaintext
32 lines
1.4 KiB
Plaintext
# Kernel hardening, mostly the KSPP recommendations (Talos sets these too), and one limit raised
|
|
# for containers. Left out on purpose: user.max_user_namespaces=0 breaks rootless podman, and
|
|
# kernel.modules_disabled=1 breaks loading the network modules podman needs.
|
|
|
|
# Hide kernel addresses (they help exploits bypass KASLR), even from root.
|
|
kernel.kptr_restrict = 2
|
|
# Only root may read the kernel log; it leaks addresses.
|
|
kernel.dmesg_restrict = 1
|
|
# No perf events for non-root users.
|
|
kernel.perf_event_paranoid = 3
|
|
# Harden the BPF JIT against JIT spraying.
|
|
net.core.bpf_jit_harden = 2
|
|
# No BPF for non-root users, and no switching it back on at runtime.
|
|
kernel.unprivileged_bpf_disabled = 1
|
|
# No kexec: no booting another kernel past Secure Boot.
|
|
kernel.kexec_load_disabled = 1
|
|
# No core dumps of setuid programs; they can hold secrets.
|
|
fs.suid_dumpable = 0
|
|
# No loading TTY line disciplines on demand; old ones had exploitable bugs.
|
|
dev.tty.ldisc_autoload = 0
|
|
# userfaultfd only for root; it makes kernel race exploits reliable.
|
|
vm.unprivileged_userfaultfd = 0
|
|
# No opening FIFOs and files owned by others in sticky directories like /tmp.
|
|
fs.protected_fifos = 2
|
|
fs.protected_regular = 2
|
|
# ptrace only on your own descendants.
|
|
kernel.yama.ptrace_scope = 1
|
|
|
|
# Containers (file watchers, systemd in containers) run out of Fedora's 128 inotify instances
|
|
# per user; 8192 is common on Kubernetes nodes.
|
|
fs.inotify.max_user_instances = 8192
|