#!/bin/bash # Healthcheck: the interface must exist and have at least one peer. # A stale handshake is not failed here — that's the watchdog's job on the # LXC (client) side; the server is passive and only responds. set -euo pipefail IFACE="${WG_INTERFACE:-wg0}" ip link show "$IFACE" >/dev/null 2>&1 || exit 1 wg show "$IFACE" >/dev/null 2>&1 || exit 1 # Must have at least one peer configured. peers=$(wg show "$IFACE" peers | wc -l) [[ "$peers" -ge 1 ]] || exit 1 exit 0