Files
runneros/mkosi.extra/usr/lib/sysctl.d/50-git-runner.conf
T
Job79andClaude Opus 5.5 c2ec9ddb29 Smaller image: fewer kernel modules and files, unused services removed, oomd for jobs
- Kernel modules: all but hardware drivers, plus the VM and podman network drivers.
- Removed: System.map, the udev hwdb, and the homed/userdbd/nsresourced units.
- Job image: no translations (Locale=C.UTF-8).
- systemd-oomd kills the job container that runs the VM out of memory.
- gitea-runner waits for first-boot setup instead of restarting every 10s.
- Tighter comments in the sysctl config; Verify=no explained in the transfers.

/usr: 367 -> 307 MB, update download 317 -> 260 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V27snrGfdvwU7pMNBiDpHv
2026-11-14 11:55:48 +01:00

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 podman in jobs, 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