Files

WireGuard Star via data-mesher

WireGuard VPN in a star topology with dynamic peer management via data-mesher.

Unlike the static wireguard-star service, peers and controllers discover each other at runtime through data-mesher. Adding or removing a peer does not require rebuilding the controller.

Roles

controller

The center of the star. Publishes its WireGuard public key and endpoint via a static (signing-key-authorized) data-mesher file. Watches for peer announcements and reconfigures WireGuard dynamically using wg syncconf.

Interface options:

  • endpoint — where the controller is reachable, e.g. "vpn.example.com:51820"

peer

Connects to the controller. Announces itself via a data-mesher signed namespace using the node's identity certificate. The controller discovers the peer automatically.

The peer re-publishes its data-mesher file every 2 minutes with a 10 minute TTL. If the machine stops heartbeating — clean shutdown, crash, decommissioned, network partition — the TTL elapses and data-mesher reaps the file cluster-wide. The controller's path-watcher fires when the file disappears locally and the dead peer is automatically removed from the WireGuard config. No manual cleanup required.

Interface options:

  • allowedIPs — additional IP ranges to route through the tunnel (default: [])

Addressing

Each machine derives a deterministic IPv6 ULA address from a SHA-256 hash of its WireGuard public key. No coordination or assignment protocol is needed.

Security

  • The controller's data-mesher file uses explicit signing-key authorization. Only the controller machine has the signing key — peers cannot forge it.
  • Peer files use signed namespaces. Each peer can only write to its own namespace path (dm_wg_star_<instance>/<identity_pubkey>).
  • A compromised peer can only affect its own announcement.

Prerequisites

  • The data-mesher service must be running on all machines.
  • The data-mesher clan service must support namespace exports (dataMesher.namespaces merging from exports).
  • data-mesher must support per-file TTLs via --expires-in (the valid_for signature field).