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
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-14 11:55:48 +01:00
1 parent 97355554f4
commit c2ec9ddb29
9 files changed
+64 -21

No files matched your search

+16 -16
View File
@@ -1,31 +1,31 @@
# 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.
# 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 in /proc and logs, even from root; they help exploits bypass KASLR.
# 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 and hardware details).
# Only root may read the kernel log; it leaks addresses.
kernel.dmesg_restrict = 1
# No perf events for non-root users. Upstream kernels treat 3 like 2 (the strictest they know).
# No perf events for non-root users.
kernel.perf_event_paranoid = 3
# Harden the BPF JIT against JIT spraying, for every user. Small cost when BPF is used.
# Harden the BPF JIT against JIT spraying.
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).
# No BPF for non-root users, and no switching it back on at runtime.
kernel.unprivileged_bpf_disabled = 1
# No kexec: nobody can boot another kernel without going through Secure Boot.
# No kexec: no booting another kernel past Secure Boot.
kernel.kexec_load_disabled = 1
# No core dumps of setuid programs; they can contain secrets.
# No core dumps of setuid programs; they can hold secrets.
fs.suid_dumpable = 0
# Don't load TTY line disciplines on demand; old ones have had exploitable bugs.
# No loading TTY line disciplines on demand; old ones had exploitable bugs.
dev.tty.ldisc_autoload = 0
# userfaultfd only for root; it is used to make kernel race exploits reliable.
# userfaultfd only for root; it makes kernel race exploits reliable.
vm.unprivileged_userfaultfd = 0
# Don't open FIFOs and regular files owned by someone else in sticky directories like /tmp.
# No opening FIFOs and files owned by others 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 <other pid> doesn't).
# ptrace only on your own descendants.
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.
# 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