fix(heartbeat): Generate VPS WG keypair on OTA from pre-VPS firmware

uci-defaults only runs on first boot, so devices updating from ph3
would never generate WG keys. Heartbeat now generates them if missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 11:49:01 +00:00
parent 15acd96076
commit 29c383bb2f

View File

@@ -19,6 +19,14 @@ UPTIME="$(cut -d. -f1 /proc/uptime)"
MESH_IP=$(ip -4 addr show br-private 2>/dev/null | grep -o 'inet [0-9.]*' | cut -d' ' -f2)
MESH_IP="${MESH_IP:-unknown}"
# Generate WireGuard VPS keypair if missing (OTA from pre-VPS firmware)
if [ "$ROLE" != "bee" ] && [ ! -f /etc/parahub/wg_vps_private.key ] && command -v wg >/dev/null 2>&1; then
umask 077
wg genkey > /etc/parahub/wg_vps_private.key
wg pubkey < /etc/parahub/wg_vps_private.key > /etc/parahub/wg_vps_public.key
logger -t parahub-heartbeat "Generated VPS WireGuard keypair (OTA migration)"
fi
# Read WireGuard VPS public key (Bumblebee only)
WG_PUBKEY=""
if [ -f /etc/parahub/wg_vps_public.key ]; then