Include device IP and hostname in firstboot alerter beacon
Blind drops need some way to locate the device when no VPN is selected. Alerter now reports public IP (via ipify) with fallback to local IP, plus hostname — gives enough info to SSH directly on same-network drops.
This commit is contained in:
+3
-1
@@ -661,9 +661,11 @@ fi
|
|||||||
# Network alerter
|
# Network alerter
|
||||||
if [[ -n "${BB_ALERTER_WEBHOOK:-}" ]]; then
|
if [[ -n "${BB_ALERTER_WEBHOOK:-}" ]]; then
|
||||||
echo "[*] Sending online alert..."
|
echo "[*] Sending online alert..."
|
||||||
|
BB_IP=$(curl -sf --max-time 5 https://api.ipify.org 2>/dev/null || hostname -I | awk '{print $1}')
|
||||||
|
BB_HOSTNAME=$(hostname)
|
||||||
curl -sf -X POST "$BB_ALERTER_WEBHOOK" \
|
curl -sf -X POST "$BB_ALERTER_WEBHOOK" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d "{\"text\":\"BigBrother ${BB_DEVICE_ID} online\"}" || true
|
-d "{\"text\":\"BigBrother ${BB_DEVICE_ID} online | ip: ${BB_IP} | host: ${BB_HOSTNAME}\"}" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[+] First-boot complete: $(date)"
|
echo "[+] First-boot complete: $(date)"
|
||||||
|
|||||||
Reference in New Issue
Block a user