Files
felhom.eu/documentation/audits/evidence-chaos-night-2026-09-17/run_round.sh
T
adminandClaude Opus 5 9f40dc3289
gates / gates (push) Successful in 21s
chaos night round 10: a restore leaves no record, and four of my instruments failed
The box passed the roughest pair drawn. A hard reset four seconds into a
restore: 26/26 containers back in 150 s, boot reconciliation naming the app it
recovered, every front door serving, one true controller_started alarm, no
false one, no intervention.

R-550 filed (P2): there is no restore record anywhere. Four candidate status
endpoints 404, no restore field in the status JSON, only a button label on the
pages, and no file at all modified in the reset window. An interrupted restore
and one that never happened look identical to the customer. Honest limit
recorded: only four seconds elapsed and the pre-reset log is unrecoverable, so
the absence of a record is what is filed, not a claim about how far it got.

Four instrument faults, all mine, all in the evidence:
  * a 'nothing was logged' claim that was unfalsifiable when written - the log
    stream holds zero lines before a reset;
  * an on-disk check against /opt/felhom/data, a directory that does not exist;
  * a household count reporting 0 lines and 0 failures when the truth was one
    line and it WAS a failure - the runner now prints both operands;
  * the disk guard was a TRANSIENT unit reporting 'active' all night, and was
    absent from the reset onward. It is now file-backed and enabled, and its
    script is copied off the box for the first time.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-09-17 01:35:56 +02:00

102 lines
6.4 KiB
Bash
Executable File

#!/bin/bash
# run_round.sh <n> <action> <app> <accident>
# One runner for every remaining round. Same five things every time, so no round is measured a
# different way from another. Actions and accidents are only the ones the seed actually drew.
set -u
N="${1:?round}"; X="${2:?action}"; Y="${3:?app}"; Z="${4:?accident}"
E=/mnt/5_hdd/felhom.eu/git/felhom.eu/documentation/audits/evidence-chaos-night-2026-09-17
OUT=$E/round-$N.txt
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"; }
say(){ echo "$(date -u +%FT%TZ) $*" | tee -a $OUT; }
door(){ curl -sL -o /dev/null -w '%{http_code}' --max-time 12 -k -H "Host: $1.enkicsifelhom.hu" http://192.168.0.116/ 2>/dev/null; }
# app -> its subdomain
sub(){ case "$1" in nextcloud) echo cloud;; immich) echo photos;; bookstack) echo wiki;; privatebin) echo paste;;
gokapi) echo share;; vaultwarden) echo vault;; paperless-ngx) echo paperless;; jellyfin) echo media;;
mealie) echo recipes;; uptime-kuma) echo status;; adventurelog) echo travel;; homebox) echo inventory;; *) echo "$1";; esac; }
SUB=$(sub "$Y")
# --- the action, as a script run inside the guest -------------------------------------------------
cat > $SCR/act.sh <<PEOF
#!/bin/bash
H="Host: felhom.enkicsifelhom.hu"; B=http://172.17.0.2:8080
curl -s -o /dev/null -D /tmp/.l -H "\$H" -X POST --data-urlencode "password@/root/.pw" \$B/login
S=\$(grep -i '^set-cookie: felhom_session=' /tmp/.l | sed 's/.*felhom_session=\([^;]*\).*/\1/')
[ -z "\$S" ] && { echo "ABORT: no session — mine, not the product's"; exit 1; }
C="Cookie: felhom_session=\$S"
TOK=\$(curl -s -H "\$H" -H "\$C" \$B/backups/apps | grep -o 'name="csrf-token" content="[^"]*"' | sed 's/.*content="\([^"]*\)".*/\1/')
case "$X" in
backup-app)
echo " POST /api/backup/run -> \$(curl -s -o /tmp/.a -w '%{http_code}' -H "\$H" -H "\$C" -H "X-CSRF-Token: \$TOK" -X POST \$B/api/backup/run)"
head -c 200 /tmp/.a; echo
for i in \$(seq 1 30); do sleep 20
s=\$(curl -s -H "\$H" -H "\$C" \$B/api/backup/status | head -c 220); echo " \$s"
echo "\$s" | grep -qiE '"running":\s*false' && break; done ;;
offsite-run)
curl -s -o /dev/null -D /tmp/.r -H "\$H" -H "\$C" -X POST --data-urlencode "_csrf=\$TOK" \$B/backup/offbox/run
echo " POST /backup/offbox/run -> \$(head -1 /tmp/.r)"
echo " flash: \$(grep -i '^location:' /tmp/.r | sed 's/.*flash[_a-z]*=//' | python3 -c 'import sys,urllib.parse;print(urllib.parse.unquote_plus(sys.stdin.read().strip())[:220])' 2>/dev/null)" ;;
restore)
curl -s -o /dev/null -D /tmp/.r -H "\$H" -H "\$C" -X POST --data-urlencode "_csrf=\$TOK" \
--data-urlencode "stack_name=$Y" --data-urlencode "snapshot_id=helyi" \$B/backup/restore
echo " POST /backup/restore ($Y) -> \$(head -1 /tmp/.r)"
echo " flash: \$(grep -i '^location:' /tmp/.r | sed 's/.*flash[_a-z]*=//' | python3 -c 'import sys,urllib.parse;print(urllib.parse.unquote_plus(sys.stdin.read().strip())[:220])' 2>/dev/null)" ;;
backup-system)
echo " POST /api/guest-backup/trigger -> \$(curl -s -o /tmp/.t -w '%{http_code}' -H "\$H" -H "\$C" -H "X-CSRF-Token: \$TOK" -H 'Content-Type: application/json' -X POST \$B/api/guest-backup/trigger)"
head -c 200 /tmp/.t; echo
for i in \$(seq 1 45); do sleep 20
s=\$(curl -s -H "\$H" -H "\$C" \$B/api/guest-backup/status | head -c 220); echo " \$s"
echo "\$s" | grep -qiE '"(running|active)":\s*false|"phase":"(done|idle|error)"' && break; done ;;
use) echo " (use: driven from DooPlex through the app's own front door)" ;;
esac
rm -f /tmp/.l /tmp/.a /tmp/.r /tmp/.t
PEOF
say "================ ROUND $N : $X $Y, while: $Z ================"
BEFORE=$(BOX 'pct exec 9201 -- docker ps -q | wc -l' | tr -d ' \r'); [ -z "$BEFORE" ] && BEFORE=0
say "--- BEFORE --- containers=$BEFORE $SUB=$(door $SUB) status=$(door status) paste=$(door paste)"
say " (immich/photos is a KNOWN PRE-EXISTING failure — not caused by this round)"
HL0=$(BOX 'wc -l < /root/household.log' | tr -d ' \r')
say "--- ACTION: $X on $Y ---"
if [ "$X" = "use" ]; then
for i in 1 2 3; do say " $SUB read $i -> $(door $SUB)"; done
else
sshpass -e scp $SSHO -q $SCR/act.sh root@192.168.0.115:/tmp/act.sh
BOX 'pct push 9201 /tmp/act.sh /tmp/act.sh --perms 700; pct exec 9201 -- bash /tmp/act.sh; pct exec 9201 -- rm -f /tmp/act.sh; rm -f /tmp/act.sh' | tee -a $OUT
fi
T0=$(date +%s)
if [ "$Z" = "nothing" ]; then
say "--- ACCIDENT: none — control round, deliberately ---"
else
say "--- ACCIDENT: $Z (injected after the action started) ---"
bash $E/inject.sh "$Z" "$N" 2>&1 | sed 's/^/ /' | tee -a $OUT
fi
say "--- AFTER: what the box did BY ITSELF ---"
for i in $(seq 1 40); do
N2=$(BOX 'pct exec 9201 -- docker ps -q 2>/dev/null | wc -l' | tr -d ' \r'); [ -z "$N2" ] && N2=0
say " t+$(( $(date +%s) - T0 ))s containers=$N2 (before $BEFORE)"
[ "$BEFORE" -gt 0 ] && [ "$N2" -ge "$BEFORE" ] && { say " STEADY after $(( $(date +%s) - T0 ))s"; break; }
sleep 15
done
# A door reading taken seconds after a network accident ends measures the accident, not the
# recovery. Round 8 read 530 on every door 3 s after the unblock, and 200 on every door 43 s
# later. The reading now STATES ITS OWN PRECONDITION, and a second one is always taken.
say " front doors, FIRST reading at $(date -u +%FT%TZ) - TOO EARLY to trust if the accident just ended:"
say " $SUB=$(door $SUB) status=$(door status) paste=$(door paste) wiki=$(door wiki)"
sleep 60
say " front doors, SECOND reading at $(date -u +%FT%TZ), 60 s later - THIS is the one to trust:"
say " $SUB=$(door $SUB) status=$(door status) paste=$(door paste) wiki=$(door wiki)"
HL1=$(BOX 'wc -l < /root/household.log' | tr -d ' \r')
# Round 10 reported "0 lines, 0 failures" when the truth was one line and it WAS a
# failure. A subtraction whose operands are invisible cannot be checked, so both are
# printed now, and an empty read is named rather than silently becoming zero.
say " household log lines: before=${HL0:-EMPTY} after=${HL1:-EMPTY}"
say " household lines this round: $(( ${HL1:-0} - ${HL0:-0} )) failures: $(BOX "tail -n +$(( ${HL0:-0} + 1 )) /root/household.log | grep -cE 'FAILED|UNREACHABLE'" | tr -d ' \r')"
say "--- alarms ---"; bash $E/events.sh 8 | tee -a $OUT
say "================ END ROUND $N ================"