chore: simplify image configuration

Drop the custom firewall, PS1, oomd and nftables overrides, trim sysctl
settings, and add the Secure Boot certificate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-16 19:40:51 +01:00
1 parent 9245b26500
commit bbd0364792
14 files changed
+52 -82

No files matched your search

-1
View File
@@ -12,4 +12,3 @@ You run on a small Fedora VM made for you, as the user `claude`, without root.
- **Everything resets at reboot**: your home (/var/home/claude), /tmp and all containers and
images. Only your Claude login survives. Keep results somewhere else (push them to git, for
example). The VM may reboot at about 04:10 to update.
- Incoming traffic is blocked except ssh; to serve something, the user needs a tunnel.
-2
View File
@@ -1,2 +0,0 @@
# The prompt: hostname and directory on a purple bar (the arrow needs a Powerline/Nerd font).
export PS1="\[\e[30;45m\] \h | \w \[\e[0;35m\]\[\e[m\] "
-18
View File
@@ -1,18 +0,0 @@
# Firewall: drop all incoming traffic except replies, loopback, ICMP, DHCPv6 and ssh, and forward
# nothing (rootless podman's networks live in Claude's own network namespace). Loaded by
# nftables.service.
destroy table inet firewall
table inet firewall {
chain input {
type filter hook input priority filter; policy drop;
ct state established,related accept
ct state invalid drop
iif lo accept
meta l4proto { icmp, ipv6-icmp } accept
ip6 saddr fe80::/10 udp dport 546 accept
tcp dport 22 accept
}
chain forward {
type filter hook forward priority filter; policy drop;
}
}
@@ -1,31 +1,3 @@
# 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
@@ -2,8 +2,6 @@
# login on the screen (tty1, and tty2-6 through its autovt@ alias); this file sorts first, so it wins.
enable systemd-networkd.service
enable systemd-resolved.service
enable systemd-oomd.service
enable nftables.service
enable sshd.service
enable getty@.service
enable agent-setup@.service tty1 ttyS0
@@ -8,8 +8,6 @@ After=network-online.target user@1000.service agent-boot.service
[Service]
User=claude
WorkingDirectory=~
# In user.slice, so systemd-oomd kills it (or Claude's containers), not the system (user.slice.d).
Slice=user.slice
Environment=CLAUDE_CONFIG_DIR=/var/lib/agent/claude XDG_RUNTIME_DIR=/run/user/1000
ExecStart=/usr/bin/claude remote-control --name %H
Restart=always
@@ -1,6 +0,0 @@
# Load our firewall (/usr/lib/agent/firewall.nft) instead of /etc/sysconfig/nftables.conf.
[Service]
ExecStart=
ExecStart=/usr/sbin/nft -f /usr/lib/agent/firewall.nft
ExecReload=
ExecReload=/usr/sbin/nft -f /usr/lib/agent/firewall.nft
@@ -1,7 +0,0 @@
# systemd-oomd for Claude and its containers: when they run the VM out of memory, kill the cgroup
# responsible before the VM thrashes on zram swap or the kernel's OOM killer picks sshd.
[Slice]
# Memory pressure above 60% for 30s: kill the cgroup reclaiming the most memory.
ManagedOOMMemoryPressure=kill
# Swap over 90% full: kill the cgroup using the most swap.
ManagedOOMSwap=kill
@@ -1,4 +1,8 @@
# Installs the next UKI, which systemd-boot boots by default. Verify=yes: see 10-root.transfer.
# It gets three tries (boot counting, the +@l-@d in its name; no Mode=0444, systemd-boot can't
# rename a read-only file): systemd-bless-boot marks it good once a boot gets through
# (boot-complete.target); if none does, systemd-boot goes back to the previous UKI, and with it
# the previous root partition (each UKI holds its root hash).
[Transfer]
ProtectVersion=%A
Verify=yes
@@ -12,6 +16,7 @@ MatchPattern=agent_@v.efi
Type=regular-file
Path=/EFI/Linux
PathRelativeTo=boot
MatchPattern=agent_@v.efi
Mode=0444
MatchPattern=agent_@v+@l-@d.efi agent_@v+@l.efi agent_@v.efi
TriesLeft=3
TriesDone=0
InstancesMax=2