ovpn
For operators and engineers

ovpn

Deploy Xray servers, issue client access, check the runtime, and recover from backups with a local Go CLI. State stays local and deployments go over SSH. Source-available under a non-commercial license.

Local state ~/.ovpn stores servers, users, quotas, and deploy metadata.
SSH deploy The CLI renders runtime bundles locally and applies them over SSH/SCP.
Docker runtime Xray, agent, proxy, and monitoring run under Compose in /opt/ovpn.
HA option HAProxy can front several VPN backends and apply country preset routing.

Your first connection

Download the CLI, deploy a server, create a user, and import the link or QR code into a client.

1. Download the CLI

Choose an archive from the latest release for Linux or macOS, on Intel/AMD 64-bit or ARM64. Extract it and open a terminal in that directory. Release binaries include the Linux runtime assets; Go and Docker are not required on your workstation.

2. Prepare a server

Use a clean Debian 12+ or Ubuntu 22.04+ host, a domain that resolves to it, and SSH key access. Port 443/tcp must be free and allowed through the host and provider firewalls. Connect once with ssh -i <ssh-private-key> root@<server-ip> and verify the host key. Replace all placeholders in the commands, including the SSH private key path.

3. Deploy and create access

Run the commands shown here. server init installs Docker/Compose if needed and performs the first runtime deployment. Use deploy for later runtime changes. On an existing installation, user add provisions the user across all enabled servers.

4. Connect a client

Import the personal VLESS link or terminal QR code, connect, and load an HTTPS page while checking the client's traffic counter. The client guide has platform-specific instructions. Treat the link and QR code as credentials.

doctor checks the server runtime; a successful request through the client confirms the client path. See the full quick start for download choices and troubleshooting, and the Ansible bootstrap for production host hardening.

./ovpn version

./ovpn server add \
  --name <server> \
  --host <server-ip> \
  --domain <domain> \
  --ssh-user root \
  --ssh-port 22 \
  --ssh-identity <ssh-private-key>

./ovpn server init <server>
./ovpn doctor <server>
./ovpn user add --username <user>
./ovpn user link \
  --server <server> \
  --username <user>

Control plane without a public admin API

ovpn is built around files, SSH access, and reproducible deploys. The public repository contains the tool and templates; real inventory, hostnames, tokens, keys, and local state stay outside it.

Desired state on the operator machine

Servers, users, quotas, and deploy metadata live under ~/.ovpn. Deploy renders that state into the remote runtime.

Go CLI, Linux runtime

The operator uses one CLI. Release builds embed Linux runtime assets for ovpn-agent and the Telegram bot.

Docker Compose on hosts

Xray, the agent, monitoring, optional proxy, and backups are kept under /opt/ovpn for predictable maintenance.

Multi-host operations

User add/remove/enable/disable, expiry, and quota commands can apply to all enabled VPN hosts by default.

Security defaults

The minimal Xray profile blocks BitTorrent and public tracker domains. Ansible can add host-level Tor exit filtering.

Operational checks

doctor, status, logs, backup, restore, cleanup, monitoring, and release smoke checks are first-class workflows.

Architecture

Operations start from the operator machine. VPN hosts receive rendered Compose bundles. Clients connect directly to one or more VPN hosts, or through an optional HA entrypoint.

local control / remote runtime

SSH/SCP Docker Compose Desired state Optional HA
Operator machine
ovpn CLI Deploys, user changes, quotas, status checks, logs, backup, restore, cleanup, and monitoring setup.
Local state ~/.ovpn stores desired state and metadata. Private operational data stays local.
Ansible baseline Bootstrap and maintenance playbooks handle Docker, firewall, SSH, unattended upgrades, and host hardening.
VPN hosts
VPN host A /opt/ovpn contains Docker Compose, Xray on 443/tcp, ovpn-agent, config, and snapshots.
VPN host B..N Additional hosts use the same runtime model for users, quotas, health, and metrics.
Monitoring Optional Prometheus, Grafana, Alertmanager, cAdvisor, node-exporter, and Telegram operator bot.
Traffic path
HAProxy entrypoint Optional proxy node with country presets, local-destination bypass, foreign relay, and backend pool failover.
Clients Mobile and desktop clients import a VLESS link or QR and use the public 443/tcp endpoint.
Release archives contain only ovpn; embedded runtime assets are materialized during deploy.
Runtime mutations use the agent fast path and fall back to full deploy when needed.
The public workflows validate Go, Ansible, security scans, docs, and release packaging.

Automation surface

The CLI is the operator surface for initial bootstrap, normal deploys, user lifecycle, quotas, monitoring, and recovery.

Documentation

Documentation links open in the GitHub Pages renderer so Markdown files remain readable outside GitHub.

Project updates and support

Follow development notes on X, or support maintenance through the donation page.