Files
felhom.eu/documentation/audits/restore-holes-2026-10-24/tools/cut_on_line.sh
T

14 lines
718 B
Bash
Executable File

#!/usr/bin/env bash
# Power-cut VM 341 (Tester 1) the moment the controller logs that the restore copy is recorded (R-1251 live proof).
# Streams the controller log to $1 (the evidence file) — the container is recreated at boot, so this stream IS the log.
out="$1"; pat='restore copy is recorded'
ssh -o BatchMode=yes root@192.168.0.154 'pct exec 9201 -- docker logs -f --since 1s felhom-controller 2>&1' | while IFS= read -r line; do
printf '%s\n' "$line" >> "$out"
case "$line" in *"$pat"*)
t0=$(date -u +%FT%T.%3NZ)
ssh -o BatchMode=yes demo-hp 'qm stop 341 --skiplock 1' >> "$out.cut" 2>&1
echo "CUT: line seen $t0, qm stop returned $(date -u +%FT%T.%3NZ)" >> "$out.cut"
exit 0;;
esac
done