From 7bdafd316cbe49ed149a898fa67e359b17198ae3 Mon Sep 17 00:00:00 2001 From: Justin Oros Date: Thu, 16 Apr 2026 09:18:40 -0700 Subject: [PATCH] fix keyscan validation to die early if spoke tunnel is not up --- hub/onboard-spoke.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hub/onboard-spoke.sh b/hub/onboard-spoke.sh index 26a905b..3eaea95 100644 --- a/hub/onboard-spoke.sh +++ b/hub/onboard-spoke.sh @@ -31,7 +31,9 @@ mkdir -p "$(dirname "$RCLONE_CONF")" header "Checking Tunnel" info "Scanning spoke host key..." -ssh-keyscan -p "$TUNNEL_PORT" -H localhost >> "$SSH_DIR/known_hosts" 2>/dev/null +KEYSCAN=$(ssh-keyscan -p "$TUNNEL_PORT" -H localhost 2>/dev/null) +[ -n "$KEYSCAN" ] || die "Spoke not reachable on port $TUNNEL_PORT — is the tunnel up?" +echo "$KEYSCAN" >> "$SSH_DIR/known_hosts" info "Verifying spoke is reachable on port $TUNNEL_PORT..." if ssh -o BatchMode=yes -o ConnectTimeout=10 -p "$TUNNEL_PORT" armbian@localhost exit 2>/dev/null; then