gates / gates (push) Successful in 20s
Round 8 (backup-app nextcloud + internet cut) passed on the product side:
26 containers throughout, LAN doors served the whole ten minutes, public
path restored unaided in <=43 s, no alarm fired and none should have.
The finding is against my own instrument. The hub report due at 22:38:43Z
fell inside the cut and SUCCEEDED, because hub.felhom.eu resolves to a LAN
address (192.168.0.192, measured from guest and host) and the injector
allowed the whole LAN. So rounds 7 and 8 never tested hub unreachability,
and the dropped-event behaviour is still unmeasured.
Two fixes, both to the harness, neither to the product:
* inject.sh now blocks the hub address from the VM's side (the host tap
rule). The hub itself is untouched - the fence is kept. It refuses to
inject at all if it cannot resolve the hub.
* run_round.sh no longer reads the front doors 3 s after an unblock. Every
door reading now states its own timestamp and a second reading is taken
60 s later. This was the sixth mistimed reading of the night.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
115 lines
6.0 KiB
Bash
Executable File
115 lines
6.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# inject.sh — CHAOS NIGHT accident injectors. Run from DooPlex.
|
|
#
|
|
# Only the seven accidents the seed actually drew are implemented. The other six in the brief's
|
|
# table were never drawn, and writing injectors for them would suggest this night tested them.
|
|
#
|
|
# Usage: inject.sh <accident> <round>
|
|
# power-cut | hard-reset | drive-pulled-20min | internet-gone-10min
|
|
# tunnel-down-10min | docker-restart | disk-95-full
|
|
set -u
|
|
A="${1:?accident}"; R="${2:?round}"
|
|
VM=336
|
|
E=/mnt/5_hdd/felhom.eu/git/felhom.eu/documentation/audits/evidence-chaos-night-2026-09-17
|
|
LOG="$E/round-${R}-accident.txt"
|
|
H(){ ssh hp "$@" 2>/dev/null | grep -vE "locale|LC_|LANG|perl:|supported and installed|are supported"; }
|
|
say(){ echo "$(date -u +%FT%TZ) $*" | tee -a "$LOG"; }
|
|
# The customer guest lives inside the nested PVE. `qm guest exec` is UNUSABLE on this box (no
|
|
# qemu-guest-agent — measured in Phase 0), so in-guest work goes over SSH then `pct exec`.
|
|
SCR=$(ls -d /tmp/claude-1000/-mnt-5-hdd-felhom-eu-git/*/scratchpad/chaos 2>/dev/null | head -1)
|
|
export SSHPASS=$(cat $SCR/boxroot.pw)
|
|
SSHO="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10 -o NumberOfPasswordPrompts=1"
|
|
BOX(){ sshpass -e ssh $SSHO root@192.168.0.115 "$@" 2>/dev/null | grep -v "Warning: Permanently"; }
|
|
G(){ BOX "pct exec 9201 -- $*" ; }
|
|
|
|
say "ACCIDENT=$A round=$R"
|
|
case "$A" in
|
|
power-cut)
|
|
say "qm stop $VM (the plug is pulled — no clean shutdown)"
|
|
H "qm stop $VM"; say "stopped; waiting 60 s with the box dark"
|
|
sleep 60
|
|
H "qm start $VM"; say "power back on"
|
|
;;
|
|
hard-reset)
|
|
say "qm reset $VM (the reset button, mid-write)"
|
|
H "qm reset $VM"; say "reset issued"
|
|
;;
|
|
drive-pulled-20min)
|
|
F=$(H "qm config $VM | grep '^scsi1:' | sed 's/scsi1: //; s/,.*//'")
|
|
say "data disk is $F — detaching it from the RUNNING box (the cable is pulled)"
|
|
H "qm set $VM --delete scsi1"; say "detached; the disk file stays as unused0"
|
|
say "leaving it out for 20 minutes"
|
|
sleep 1200
|
|
H "qm set $VM --scsi1 $F"; say "re-attached: $F"
|
|
;;
|
|
internet-gone-10min)
|
|
TAP=$(H "ls /sys/class/net | grep -E \"^tap${VM}i0$\"")
|
|
[ -n "$TAP" ] || { say "NO TAP FOUND for VM $VM — accident NOT injected, and that is recorded as such"; exit 1; }
|
|
HUBIP=$(H "getent hosts hub.felhom.eu | awk '{print \$1}' | head -1" | tr -d ' \r')
|
|
[ -n "$HUBIP" ] || { say "HUB ADDRESS NOT RESOLVABLE - accident NOT injected. An instrument that cannot find its target must not pretend it blocked it."; exit 1; }
|
|
say "blocking the box traffic off-LAN at the HOST, on $TAP; the LAN stays up EXCEPT the hub ($HUBIP)"
|
|
H "sysctl -w net.bridge.bridge-nf-call-iptables=1 >/dev/null
|
|
iptables -I FORWARD 1 -m physdev --physdev-in $TAP -d 192.168.0.0/24 -j ACCEPT
|
|
iptables -I FORWARD 2 -m physdev --physdev-in $TAP -j DROP
|
|
iptables -I FORWARD 1 -m physdev --physdev-in $TAP -d $HUBIP -j DROP"
|
|
# UNCONDITIONAL cleanup: if this script is killed during the sleep, or the SSH drops, the host
|
|
# must NOT be left with the rules in place and the sysctl flipped. demo-hp is a Tier-0 host that
|
|
# 9201 and 9202 also live on, and an abandoned FORWARD rule is a fence breach, not a measurement.
|
|
netcleanup(){
|
|
H "iptables -D FORWARD -m physdev --physdev-in $TAP -d $HUBIP -j DROP 2>/dev/null
|
|
iptables -D FORWARD -m physdev --physdev-in $TAP -j DROP 2>/dev/null
|
|
iptables -D FORWARD -m physdev --physdev-in $TAP -d 192.168.0.0/24 -j ACCEPT 2>/dev/null
|
|
sysctl -w net.bridge.bridge-nf-call-iptables=0 >/dev/null 2>&1" >/dev/null 2>&1
|
|
say "net cleanup ran (rules removed, sysctl restored)"
|
|
}
|
|
trap 'netcleanup' EXIT INT TERM
|
|
say "blocked (LAN allowed EXCEPT the hub at $HUBIP, everything else dropped) - 10 minutes"
|
|
sleep 600
|
|
H "iptables -D FORWARD -m physdev --physdev-in $TAP -d $HUBIP -j DROP
|
|
iptables -D FORWARD -m physdev --physdev-in $TAP -j DROP
|
|
iptables -D FORWARD -m physdev --physdev-in $TAP -d 192.168.0.0/24 -j ACCEPT
|
|
sysctl -w net.bridge.bridge-nf-call-iptables=0 >/dev/null"
|
|
trap - EXIT INT TERM
|
|
say "unblocked; host sysctl restored to 0 and both rules removed"
|
|
H "iptables -S FORWARD | head -5" | tee -a "$LOG"
|
|
;;
|
|
tunnel-down-10min)
|
|
say "docker kill cloudflared inside the customer guest"
|
|
G "docker kill cloudflared" ; say "tunnel killed — 10 minutes"
|
|
sleep 600
|
|
say "10 minutes up; NOT restarting it by hand — whether it returns by itself IS the measurement"
|
|
;;
|
|
docker-restart)
|
|
say "systemctl restart docker inside the customer guest"
|
|
G "systemctl restart docker"; say "docker restarted"
|
|
;;
|
|
disk-95-full)
|
|
say "filling the customer guest's SYSTEM disk to ~95 % — with a POOL GUARD"
|
|
POOLPCT=$(BOX "lvs --noheadings -o data_percent pve/data 2>/dev/null" | tr -d ' %\r' | cut -d. -f1)
|
|
AVAIL=$(G "df --output=avail -m / | tail -1" | tr -d ' \r')
|
|
say " pool now: ${POOLPCT}% used; guest / has ${AVAIL} MB free"
|
|
WANT=$(( AVAIL * 95 / 100 ))
|
|
POOLFREE_MB=$(( (100 - ${POOLPCT:-50}) * 75810 / 100 ))
|
|
CAP=$(( POOLFREE_MB * 70 / 100 ))
|
|
if [ "$WANT" -gt "$CAP" ]; then
|
|
say " DECLARED DEVIATION: filling ${CAP} MB instead of ${WANT} MB. The guest's disks are thin"
|
|
say " provisioned over a shared pool that hit 100 % earlier tonight and remounted the box"
|
|
say " read-only; writing the full 95 % would re-wedge the box rather than measure it."
|
|
WANT=$CAP
|
|
fi
|
|
G "df -h /" | tail -1 | tee -a "$LOG"
|
|
G "fallocate -l ${WANT}M /var/tmp/.chaosfill" >/dev/null 2>&1
|
|
G "df -h / | tail -1" | tee -a "$LOG"
|
|
say " pool after the fill: $(BOX "lvs --noheadings -o data_percent pve/data" | tr -d ' \r')"
|
|
say "full — holding 10 minutes"
|
|
sleep 600
|
|
# two plain calls: G() flattens its argument through `pct exec`, so a nested bash -c '...' has
|
|
# its quoting re-parsed by the remote shell and dies with "unexpected EOF". Measured in round 3.
|
|
G "rm -f /var/tmp/.chaosfill"
|
|
G "df -h /" | tail -1 | tee -a "$LOG"
|
|
say "freed"
|
|
;;
|
|
*) say "UNKNOWN ACCIDENT $A"; exit 2 ;;
|
|
esac
|
|
say "accident $A complete"
|