Files
wirecon/docker/wg/healthcheck.sh
T
d4nn13 49b01dfcd3 initial commit: wirecon WireGuard stack
Rootless-Docker server (wireguard-go + Caddy sharing netns) and
unprivileged-LXC client (kernel WG + systemd watchdog/monitor/MTU-probe)
with curl-pipeable bootstrap. Tuned for Telekom DSL/LTE Hybrid uplinks.
2026-04-19 18:20:21 +02:00

17 lines
480 B
Bash
Executable File

#!/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