REST API for managing a local OpenVPN server and its clients on Linux (Debian/Ubuntu). Handles the full lifecycle: installing OpenVPN, initializing PKI, generating client profiles, managing firewall rules, and monitoring connections.
Compiles to a single binary for easy deployment.
On a Debian/Ubuntu server with root access:
curl -fsSL https://raw.githubusercontent.com/rizaleow/ovpn-manager/main/install.sh | bashThis installs the binary, system dependencies (OpenVPN, EasyRSA, iptables), systemd service, and default config.
To install a specific version:
curl -fsSL https://raw.githubusercontent.com/rizaleow/ovpn-manager/main/install.sh | bash -s -- --version v0.0.2Upgrade or uninstall:
install.sh upgrade
install.sh uninstall- Linux (Debian/Ubuntu)
- Bun v1.3+
- Root access (for systemctl, iptables, sysctl)
bun installbun run dev# Native binary
bun run build
# Cross-compile for Linux x64
bun run build:linux
# Cross-compile for Linux arm64
bun run build:linux-arm64Produces a self-contained binary at dist/ovpn-manager.
Config is resolved from (in order): --config <path> flag, OVPN_MANAGER_CONFIG env var, or /etc/ovpn-manager/config.json.
Copy config.example.json to get started. If apiKey is empty, one is auto-generated on first run.
# Run the binary
sudo ./dist/ovpn-manager --config /etc/ovpn-manager/config.json
# Health check (no auth)
curl http://127.0.0.1:3000/health
# Bootstrap the server
curl -X POST http://127.0.0.1:3000/api/setup \
-H "X-API-Key: <key>" \
-H "Content-Type: application/json" \
-d '{"hostname": "vpn.example.com"}'
# Create a client
curl -X POST http://127.0.0.1:3000/api/clients \
-H "X-API-Key: <key>" \
-H "Content-Type: application/json" \
-d '{"name": "alice"}'
# Download .ovpn profile
curl http://127.0.0.1:3000/api/clients/alice/profile \
-H "X-API-Key: <key>" -o alice.ovpnAll /api/* routes require an X-API-Key header.
bun test