Files
LEAF/scripts/reboot-check.sh
2026-11-15 17:42:55 +01:00

18 lines
776 B
Bash

#!/usr/bin/env bash
# Read-only recovery inspection. Never reboots either the sensor or VIPERA.
set -euo pipefail
VM="${VM:-yuru@192.168.100.84}"
KEY="${LEAF_SSH_KEY:-$HOME/.ssh/id_ed25519_alice}"
ssh -F /dev/null -o BatchMode=yes -o ConnectTimeout=8 -i "$KEY" "$VM" '
set -eu
[ "$(hostname)" = LEAF-PROTO ]
systemctl is-active --quiet leaf-controller suricata-leaf leaf-eve-rotate.timer
systemctl is-enabled --quiet leaf-controller suricata-leaf leaf-eve-rotate.timer
[ "$(findmnt -n -o FSTYPE --target /var/log/suricata-leaf)" = tmpfs ]
sudo -n test -S /run/suricata/alerts.sock
printf "boot_id="; cat /proc/sys/kernel/random/boot_id
uptime -s
sudo -n python3 /opt/leaf-controller/tools/leaf-live-helper.py status
printf "RECOVERY INSPECTION PASS (no reboot performed)\n"
'