Skip to content

Tunnel/Client API

This API is present on the tunnel HTTP/S listener and is exposed to the wireguard peers on the wag host IP address.

GET /public_key or /api/public_key

This endpoint returns the server public wireguard key.

Return codeContentMeaning
500N/AFailed to query wireguard device, check server logs
200Server public key as text/plain

GET /status or /api/status

Return JSON object representing user authorisation status and mfa/allow/denied routes.

State Object Schema (v9.1.4):

json
{
	"IsAuthorised": "bool",
	"MFA":    ["string"],
	"Public": ["string"],
	"Deny":   ["string"]
}

The various rules will be in Wag rule syntax, e.g:

json
["somehost.somewhere 22/tcp", "1.1.1.1/32"]
Return codeContentMeaning
500N/AFailed to query wireguard device, check server logs
200Authorisation state application/json

GET /routes or /api/routes

Returns a comma (,) delimited list of ip addresses that the VPN is responsible for.

Return codeContentMeaning
500N/AFailed to query wireguard device, check server logs
200IP addresses text/plainThe routes the vpn client can send to the vpn (i.e whats captured by the vpn)

POST /logout or /api/logout

End the authorised session of the client

Return codeContentMeaning
500N/AFailed to query wireguard device, check server logs
204N/AClient session has been ended, no longer able to access MFA routes
404N/AClient wasnt already authorised

Released under the MIT License