Documentation - Three levels: DOCS/General (overview, configuration), DOCS/Deployment (choose a method, first steps), details per method in Containers/ and System_Services/; new root README and DOCS/README map. - Remove superseded pages (Deployment.md, Deployment_Docker/Native.md, Index.md); split the two scenario guides by section. - Isolate the Timeweb/Hysteria2 records in DEPLOYMENTS/timeweb-hysteria2/ (not linked from DOCS, listed in .graphifyignore). - Add DOCS/code_review/ with a time-stamped analysis of the code base. Gatherer (BUG-02, BUG-03) - Session key (CN, address, connected_since_ts), baseline from the active_sessions snapshot, grace period for sessions missing from the status. - Status file integrity (TITLE/TIME/END) and freshness; a torn read skips the tick. - Cache applied after commit; main loop survives exceptions, backs off, and stops cleanly on SIGTERM/SIGINT; new client rows start with the first frame's totals; five tests. JWT signing key (SEC-01) - No built-in default: Core and Profiler refuse to start with a missing, placeholder or short (< 32) key; shipped config.ini has an empty value. - Same rule in install.sh, update.sh (issues a new key when missing or weak), docker lib/entrypoint; five tests, conftest.py for the test key. Each change has a plan and a summary under DOCS/Changes/. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
12 KiB
System services (Alpine, Debian, Ubuntu)
Install the suite as system services without containers. This page: what gets installed, supported systems, requirements, install per OS, verification. Next pages: Operations (update, backup, rollback), Reference (paths, environment, helper), Web UI, Firewall, Nginx, Services, Troubleshooting.
Quick start
As root on Alpine 3.23, Debian 12 or Ubuntu 24.04 (the script installs all other packages and asks for the install directory):
# Debian/Ubuntu: apt-get update && apt-get install -y git Alpine: apk add git
git clone <repository> /root/ovpmon-src && cd /root/ovpmon-src
deploy/native/install.sh --prefix /opt/OpenVPN-Monitoring-Simple
The script prints the URL (https://<host>:8088/), the certificate fingerprint and the administrator login and password (shown once). Open the URL, then follow First steps. Details per system are below.
Scripts
Install and update on Alpine (OpenRC), Debian and Ubuntu (systemd) with the scripts in deploy/native/. Nothing runs in a container. The web UI is part of the repository (deploy/ui-dist) and is installed automatically, so the host needs no Node.
| Script | Purpose |
|---|---|
deploy/native/build-ui.sh |
builds the web UI (Docker, or the local Node without a container) into a tarball and/or into the repository (--publish) |
deploy/native/check-ui.sh |
checks that the committed UI build deploy/ui-dist matches the APP_UI sources (exit 1 when stale) |
deploy/native/install.sh |
first installation: packages, user, code, virtualenvs, configuration, services, nginx with TLS, health checks |
deploy/native/update.sh |
update with a verified backup, a separate database migration step and automatic rollback; --rollback for a manual one |
deploy/native/backup.sh / restore.sh |
stand-alone backup (cron friendly) and restore |
deploy/native/lib.sh |
shared functions and the OS adapter (sourced, not executed) |
All scripts run as root, support -h, log in one style (UTC time stamp, === PHASE n ===) and append every log line to /var/log/ovpmon-deploy.log.
What is installed
Browser --https:8088--> nginx --/--------------> /var/www/ovpmon (UI files)
--/api/----------> 127.0.0.1:5001 ovpmon-api (gunicorn, APP_CORE)
--/profiles-api/-> 127.0.0.1:8000 ovpmon-profiler (uvicorn, APP_PROFILER)
ovpmon-gatherer (APP_CORE): OpenVPN status log -> monitoring database
ovpmon-profiler (user ovpmon) --doas--> /usr/local/sbin/ovpmon-helper (root) --> server.conf, CRL, OpenVPN service
The three ovpmon-* services run as the unprivileged user ovpmon. Only the helper acts as root, through six fixed doas rules, and it validates everything it installs (see Privilege separation). The services do not require OpenVPN to be running: the VPN server is created and started from the UI.
Supported systems
| System | Tested version | Service manager | Notes |
|---|---|---|---|
| Alpine | 3.23 | OpenRC | the original reference platform |
| Debian | 12 | systemd | |
| Ubuntu | 24.04 LTS | systemd | needs the universe repository (easy-rsa, opendoas) |
Another version of these systems is refused with a warning unless you pass --force to install.sh (the update only warns). Other distributions are not supported (a Debian derivative works with --force at your own risk).
Requirements
- A host with root access, a working package manager and Internet access (packages, Python packages from PyPI).
/dev/net/tunfor OpenVPN (a normal VM has it; in containers it must be passed in).- Free space: about 1 GB for the code and virtualenvs (the script checks it), plus room for the backups.
- Python 3.9 or newer (Alpine 3.23: 3.12, Debian 12: 3.11, Ubuntu 24.04: 3.12).
- Free TCP ports
5001,8000(on127.0.0.1) and the HTTPS port (default8088). - A UI build: the clone contains one (
deploy/ui-dist, see Web UI). The host needs no Node.js unless you choose--build-ui. - GNU tar (on Alpine the package
tar; the installer adds it).
Install
Clone the repository on the target host (anywhere outside the install directory: the checkout is only the source, e.g. /root/ovpmon-src) and run, as root. The UI comes with the clone (deploy/ui-dist, see Web UI). The install directory is always asked for: pass --prefix DIR, or the script prompts for it (and for a confirmation); there is no default. Recommended: /opt/OpenVPN-Monitoring-Simple.
Alpine (OpenRC)
apk add git # only to clone; the script installs the rest
git clone <repository> /root/ovpmon-src && cd /root/ovpmon-src
deploy/native/install.sh --prefix /opt/OpenVPN-Monitoring-Simple
Debian 12
apt-get update && apt-get install -y git
git clone <repository> /root/ovpmon-src && cd /root/ovpmon-src
deploy/native/install.sh --prefix /opt/OpenVPN-Monitoring-Simple
Ubuntu 24.04
sudo -i
apt-get update && apt-get install -y git # make sure the "universe" component is enabled
git clone <repository> /root/ovpmon-src && cd /root/ovpmon-src
deploy/native/install.sh --prefix /opt/OpenVPN-Monitoring-Simple
Options:
| Option | Meaning |
|---|---|
--prefix DIR |
install directory, required: asked interactively when the option is missing (without a terminal the script stops). Absolute path of letters, digits, . _ - /, no trailing /; must be new or empty, must not be the repository checkout (or contain it, or lie inside it) and must not be a system directory (/, /opt, /root, /usr, /var, ...) |
--ui-dist FILE|DIR |
UI tarball from build-ui.sh or a directory with index.html; highest priority |
--build-ui |
build the UI now from APP_UI (Docker, otherwise the host's Node 20.19+) instead of using deploy/ui-dist |
--node-download |
with --build-ui: use a temporary official Node 20 (checksum verified, glibc only) |
--no-ui |
install a placeholder page on purpose; without any UI source and without this option the install stops |
--https-port N |
HTTPS port of the web UI (default 8088) |
--host-name NAME |
DNS name or IP for the certificate and the CORS origin (default: the detected address of the default route) |
--admin-user NAME |
login of the first administrator (default admin) |
--force |
continue on an untested OS version |
Differences between the systems
| Alpine 3.23 | Debian 12 / Ubuntu 24.04 | |
|---|---|---|
| Packages | python3 py3-pip nginx openvpn easy-rsa iptables bash doas openssl curl tar |
python3 python3-venv python3-pip nginx openvpn easy-rsa iptables opendoas openssl curl ca-certificates tar iproute2 |
| Service manager | OpenRC: rc-service NAME start|stop|restart|status, rc-update add NAME default |
systemd: systemctl start|stop|restart|status NAME, systemctl enable NAME |
| Our service files | /etc/init.d/ovpmon-api, -gatherer, -profiler (supervise-daemon, command_user=ovpmon:ovpmon) |
/etc/systemd/system/ovpmon-*.service (User=ovpmon, EnvironmentFile=/etc/ovpmon/env) |
| Service logs | /var/log/ovpmon/ovpmon-<name>.log |
journalctl -u ovpmon-<name> |
| OpenVPN service | openvpn; config /etc/openvpn/server.conf, plus the link /etc/openvpn/openvpn.conf -> server.conf |
openvpn-server@server; config /etc/openvpn/server/server.conf |
| nginx site | /etc/nginx/http.d/ovpmon.conf |
/etc/nginx/conf.d/ovpmon.conf |
| doas | package doas; our rules in /etc/doas.d/ovpmon.conf (own file, as on the existing hosts) |
package opendoas; our rules as a marked block inside /etc/doas.conf |
ovpmon user |
adduser -S, shell /sbin/nologin |
useradd --system, shell /usr/sbin/nologin |
The nginx site does not collide with the distribution defaults: the default server of Alpine and Debian listens on port 80, ours on 8088, and both distribution nginx.conf files include the directory above (the installer checks the include line).
What install.sh does
| Phase | Content |
|---|---|
| 0 Preflight | root, OS and version, service manager present, no existing installation (otherwise it points to update.sh), source checkout complete, UI source found (and built for --build-ui; a stale committed build only warns), ports free, free space |
| 1 Packages | the table above; GNU tar, Python 3.9+ with venv and sqlite3, easy-rsa checked |
| 2 User and directories | user ovpmon; /var/lib/ovpmon (+ staging/), /var/log/ovpmon, /var/log/openvpn (with openvpn-status.log as root:ovpmon 640), /etc/openvpn/scripts, /etc/ovpmon |
| 3 Code | APP_CORE and APP_PROFILER copied to the prefix (without venvs, databases, logs, Dockerfiles), plus the scripts and templates under deploy/ and DOCS/General/ (so the install directory can run update.sh --source ...); VERSION |
| 4 Virtualenvs and easy-rsa | two virtualenvs (pip install -r requirements.txt, plus gunicorn for APP_CORE), an import check, the easy-rsa workspace copied from /usr/share/easy-rsa into APP_PROFILER/easy-rsa (a real directory, never a symlink), code made root-owned and read-only |
| 5 Configuration | /etc/ovpmon/env (random secret, generated administrator), /etc/ovpmon/helper.conf, /usr/local/sbin/ovpmon-helper, doas rules and a self-test (ovpmon runs the helper through doas), forwarding via /etc/sysctl.d, OpenVPN prerequisites (Alpine: the openvpn.conf link; Debian/Ubuntu: /etc/openvpn/server/; the OpenVPN service is enabled, not started: there is no server.conf yet) |
| 6 Services, UI, nginx | the three service definitions installed and enabled, UI files to /var/www/ovpmon (validated, swapped in atomically, with .ui-source-hash), a self-signed EC certificate (/etc/ovpmon/tls/, SAN: host name, detected IP, 127.0.0.1, localhost), the nginx site, nginx enabled and reloaded |
| 7 Start and checks | services started; health checks (below) |
| 8 Administrator | when a user exists in the monitoring database, the seed is removed from /etc/ovpmon/env and ovpmon-api is restarted; if the database cannot be read or is empty the seed stays and a warning says so |
Health checks: the three services are running; http://127.0.0.1:5001/ answers; http://127.0.0.1:8000/ returns 200; https://127.0.0.1:<port>/ (with -k) returns 200; /api/v1/user/me and /profiles-api/config through nginx return 401 without a token.
The final summary shows the URL, the certificate fingerprint, the paths and the generated administrator password once. The state is recorded in /etc/ovpmon/deploy.state (prefix, HTTPS port, OS, version, dates). If the script fails it is safe to run again: it resumes, keeps the existing secret, certificate, easy-rsa workspace and data.
Then in the UI: sign in, change the password and enable 2FA, PKI Configuration -> Initialize PKI, generate the server configuration, start the VPN server.
Without the script (outline)
Create the ovpmon user and the directories, copy the code, build both virtualenvs, write /etc/ovpmon/env, helper.conf and the doas rules from the templates, install the service definitions (DOCS/General/systemd/*.service or DOCS/General/openrc/ovpmon-*; replace /opt/OpenVPN-Monitoring-Simple if you use another prefix), copy the UI, add the nginx site from deploy/native/nginx/ovpmon.conf.template (replace @HTTPS_PORT@, @WEB_ROOT@, @TLS_CRT@, @TLS_KEY@). The commands are exactly what install.sh runs; reading the script is the shortest reference.
Verify an installation
rc-status | grep -E "ovpmon|nginx|openvpn" # Alpine; Debian/Ubuntu: systemctl status 'ovpmon-*' nginx
ss -tlnp | grep -E ":(8088|5001|8000) "
curl -sk -o /dev/null -w "%{http_code}\n" https://127.0.0.1:8088/ # 200
curl -sk -o /dev/null -w "%{http_code}\n" https://127.0.0.1:8088/profiles-api/config # 401 without a token
su -s /bin/sh ovpmon -c "doas -n /usr/local/sbin/ovpmon-helper service status" # JSON, not "Operation not permitted"
Next
First steps · Web UI · Operations · Reference · Firewall · Troubleshooting · Choose another method