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.
| `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 |
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](../Changes/2026-09-30_Privilege_Separation.md)). 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 |
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/tun` for 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.
The UI is built from `APP_UI` (Vue/Vite). The repository carries a ready build in `deploy/ui-dist/` together with `SOURCE_HASH`, a SHA-256 over the UI sources it was built from (`APP_UI/src`, `public`, `index.html`, `package.json`, `package-lock.json`, `vite.config.js`, `jsconfig.json`). `install.sh` and `update.sh` find the UI themselves. The directory is outside `APP_UI`, so the container builds are not affected.
### Three ways to get the UI onto a host
| Way | Option | When |
|---|---|---|
| Committed build | none (automatic) | the normal case: `git clone`, `install.sh`, done; no Node, no Docker |
| Build on the host | `--build-ui` | the committed build is stale or missing; builds from `APP_UI` now with Docker (when its daemon works) or the host's Node 20.19+ |
| Build elsewhere | `--ui-dist FILE\|DIR` | a tarball from `build-ui.sh` or a directory with `index.html`, for example from a CI job or another machine |
Order used by `install.sh` and `update.sh`: **1.**`--ui-dist` (explicit, always installed), **2.**`--build-ui` (always builds fresh from the sources), **3.** the committed `deploy/ui-dist` of the checkout (automatic), **4.** nothing found: `install.sh`**stops** (it lists the ways out) unless `--no-ui` is given (a placeholder page on purpose); `update.sh` keeps the installed UI. `install.sh` also still accepts `deploy/native/ui-dist.tar.gz` as a last resort below the committed directory. `--ui-dist` and `--build-ui` exclude each other.
The installed web root records the hash it came from in `/var/www/ovpmon/.ui-source-hash` (`unknown` for archives that were not made by `build-ui.sh`). `update.sh` compares it with the `SOURCE_HASH` of the repository build: equal, the UI is not replaced (and it says so); different or missing (for example a host installed with `--no-ui`), the new UI is staged in phase 3 and swapped in phase 6, with the rest of the update, so it is part of the backup and the automatic rollback. The UI source is decided after `git pull`, so a pulled new build is used in the same run. The old UI is in the backup.
### Staleness guard
When the hash of the current `APP_UI` sources differs from `SOURCE_HASH`, the committed build is **older than the sources** (someone changed the UI and did not refresh the build). `install.sh` and `update.sh` then print a loud warning with the two hashes and the remedy, and still use the committed build (it works, it only lacks the latest UI changes). A host that needs the current UI adds `--build-ui`. A build without a valid `SOURCE_HASH` counts as stale.
### Maintainer routine
After every change in `APP_UI` (or its `package*.json`, `vite.config.js`), **before committing**:
```sh
deploy/native/build-ui.sh --publish # rebuilds deploy/ui-dist/ and SOURCE_HASH from the current sources
deploy/native/check-ui.sh # prints fresh | stale | missing; exit 0 | 1 | 2
`check-ui.sh` also fits a release checklist or a CI step (it changes nothing). `--publish` replaces the content of `deploy/ui-dist/` by a move (the old directory is only deleted after the new one is in place).
deploy/native/build-ui.sh # Docker if it works, otherwise local Node -> deploy/native/ui-dist.tar.gz
deploy/native/build-ui.sh --docker # node:20-alpine container (OVPMON_NODE_IMAGE or --image to change)
deploy/native/build-ui.sh --local # Node >= 20.19 and npm of this machine, no container
deploy/native/build-ui.sh --local --node-download # temporary official Node 20, deleted after the build
deploy/native/build-ui.sh --publish # refresh deploy/ui-dist/ in the repository
deploy/native/build-ui.sh -o /tmp/ui.tar.gz # tarball for another host (also with --publish)
deploy/native/build-ui.sh --check # only check that the builder is usable
```
Without `--docker`/`--local` the script uses Docker when its daemon answers, otherwise the local Node. The tarball holds the content of `dist/` and `SOURCE_HASH`. **Nothing is written into the source tree**: a container sees `APP_UI` read-only; `--local` copies it (without `node_modules` and `dist`) into a temporary directory and runs `npm ci` there (`npm install` without a lock file), so the repository gets no `node_modules` and no `dist`.
`--local` needs Node 20.19 or newer with npm. When it is missing or too old the script prints what to do and stops:
| Debian / Ubuntu | the distribution's Node is usually too old (Debian 12 and Ubuntu 24.04 ship Node 18): add `--node-download` (needs `apt-get install -y curl xz-utils`), or install Node 20+ with npm from nodejs.org / NodeSource |
| anything else | Node 20.19+ from nodejs.org, or build with `--docker` on a machine with Docker |
`--node-download` fetches `SHASUMS256.txt` from `https://nodejs.org/dist/latest-v20.x/`, picks `node-v20.*-linux-<x64|arm64>.tar.xz`, verifies its SHA-256, unpacks it into a temporary directory (npm cache included), builds with it and deletes everything; nothing is installed on the host. glibc systems only: on Alpine (musl) it refuses and points to `apk add nodejs npm`. It needs `curl`, `tar`, `xz` and access to nodejs.org (`OVPMON_NODE_MAJOR` selects another major version).
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 above). 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`.
| `--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 |
| 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` |
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).
| 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.
The profiler resolves `easy-rsa/` and `client-config/` relative to its working directory (`APP_PROFILER`) and keeps `client-config/<name>.ovpn` as a relative path in its database; therefore both are real directories inside `APP_PROFILER` (a symlinked `client-config` breaks the real-path checks and the `clear_pki` cleanup).
## Environment file and helper configuration
`/etc/ovpmon/env` (`root:root` 600) is read by the init system as root and handed to the services. Lines are `KEY=VALUE` without quotes or spaces (systemd and OpenRC read the same file).
| Variable | Default written by `install.sh` | Meaning |
|---|---|---|
| `OVPMON_API_SECRET_KEY` | random, 64 hex characters | signing key of both APIs; changing it logs everybody out; keep it across updates |
| `OVPMON_API_HOST`, `OVPMON_API_PORT` | `127.0.0.1`, `5001` | informational: gunicorn is started with `-b 127.0.0.1:5001` |
| `OVPMON_OPENVPN_MONITOR_LOG_PATH` | `/var/log/openvpn/openvpn-status.log` | status log read by the gatherer |
| `OVPMON_LOGGING_LEVEL` | `INFO` | |
| `OVPMON_CORS_ORIGINS` | `https://<host>:<https-port>` | extra allowed origin (the UI is same-origin behind nginx) |
| `OVPMON_RUNTIME` | `host` | forces host mode (never "container"), needed when the host itself runs inside a container |
| `OVPMON_OPENVPN_SERVICE` | `openvpn` (Alpine) / `openvpn-server@server` | service name for the root (non-helper) path |
| `OVPMON_OPENVPN_CONFIG` | `/etc/openvpn/server.conf` / `/etc/openvpn/server/server.conf` | server config path for the root (non-helper) path |
| `OVPMON_INITIAL_ADMIN_USER`, `OVPMON_INITIAL_ADMIN_PASSWORD` | generated | seed, only while the users table is empty; removed by `install.sh` after the first start |
| `OVPMON_AUTO_MIGRATE` | unset | `0` makes the services refuse to start while migrations are pending |
With the unprivileged profiler the API only stages `server.conf`; **the helper configuration decides where it is installed and which service is controlled.**
`/etc/ovpmon/helper.conf` (INI, section `[helper]`, `root:root`, not group/world writable, otherwise the helper refuses to run). Without the file the helper uses the built-in values of the Alpine layout.
OpenRC runs `/sbin/rc-service <unit> <action>`, systemd runs `systemctl <action> <unit>` (fixed argument list, fixed `PATH`). Unknown keys or invalid values make the helper refuse.
## Firewall, NAT and forwarding (manual)
The scripts **never touch the firewall**. `net.ipv4.ip_forward=1` is set persistently in `/etc/sysctl.d/98-ovpmon-forward.conf`. You open the ports and give the VPN clients access yourself. Replace `eth0` with the uplink interface and `172.20.1.0/24` with the VPN subnet of the server settings.
nft 'add chain ip ovpmon_nat postrouting { type nat hook postrouting priority 100 ; }'
nft add rule ip ovpmon_nat postrouting ip saddr 172.20.1.0/24 oifname "eth0" masquerade
```
(Add the `input`/`forward` rules only when your firewall policy is `drop`; a chain with priority 0 and policy accept does not block anything on its own.)
Persistence:
| System | Make the rules survive a reboot |
|---|---|
| Alpine | `rc-service iptables save && rc-update add iptables` (rules in `/etc/iptables/rules-save`); nftables: `rc-update add nftables`, rules in `/etc/nftables.nft` |
| Debian / Ubuntu | `apt-get install iptables-persistent`, then `netfilter-persistent save`; nftables: put the rules in `/etc/nftables.conf` and `systemctl enable nftables` |
## Update
```sh
deploy/native/update.sh # run from the checkout with the new version
deploy/native/update.sh --source /root/ovpmon-src --yes # another checkout, no questions
deploy/native/update.sh --no-pull # sources already in place / offline
deploy/native/update.sh --rollback # manual rollback to the newest backup
```
Run it from the checkout that holds the new version (the script uses the templates of that checkout). `--prefix` and the HTTPS port come from `/etc/ovpmon/deploy.state`. The update needs access to PyPI for the new virtualenvs.
| 3 Prepare | new code copied to `<prefix>.new`, fresh virtualenvs with `pip install -r requirements.txt`, import check; the UI source is decided (after `git pull`: `--ui-dist`, `--build-ui`, the committed build; unchanged hash means no swap) and the new UI is staged next to the web root. **The running system is not touched** | nothing was changed |
| 4 Stop and swap | the three application services are stopped (**OpenVPN keeps running**, VPN users stay connected); a final consistent snapshot; each code directory is renamed to `<dir>.old-<time>`, the new one moved in; **PKI, client profiles, `profiler.log`, `config.ini` and any database files below the code directory are moved over, never replaced**; virtualenv paths fixed | automatic rollback |
| 5 **Database migration** | its own step, see below | automatic rollback, **nothing is started** |
| 6 Files | UI swap (when a new UI was staged); helper; `helper.conf` (when missing); doas rules; service definitions; missing environment keys added (existing values never changed); nginx site; each replaced only when it differs and is managed by these scripts; units reloaded | automatic rollback |
| 8 Finish | the old code directories are removed (never one that still holds PKI data), the newest 5 backups kept, state recorded | |
The new `deploy/native/*.sh` take effect on the next run (the running script is not replaced).
### Database migration as its own step
After the services are stopped and the new code is in place, and **before anything is started**, `update.sh` runs for each database, with the **new** code, as user `ovpmon` and with the variables of `/etc/ovpmon/env` loaded:
| Database | Command (working directory) |
|---|---|
| Profiler | `APP_PROFILER/venv/bin/python migrate.py` in `<prefix>/APP_PROFILER` |
| Monitoring | `APP_CORE/venv/bin/python migrate.py` in `<prefix>/APP_CORE` |
For each one: `migrate.py --check` (exit 0 up to date, 2 pending, 1 error or database newer than the code), the migration when 2, and a second check. The reports are printed. A failure or a "too new" database aborts **before any service starts** and triggers the rollback. Migrations are additive, run after an integrity check and a consistent copy `<db>.bak-<UTC timestamp>` next to the database, and are verified afterwards; details in [Database migrations](../General/Database_Migrations.md). The migration also runs by itself when a service starts, so a manual file replacement is safe too; `update.sh` only makes it a visible, controlled step.
### Backup (phase 1, `backup.sh`)
```sh
deploy/native/backup.sh # backup into /var/backups/ovpmon/<UTC timestamp>/
deploy/native/backup.sh --stop # services stopped during the copy, started afterwards
deploy/native/backup.sh --keep 14# afterwards keep the newest 14
Every archive is verified (`tar -tzf`), the checksums are checked and each database copy passes `PRAGMA integrity_check` before `COMPLETE` is written; **only a `COMPLETE` backup is ever used**. `update.sh` backs up twice: in phase 1, and again as a final snapshot once the services are stopped (the code archive is reused). The backup holds private keys, password hashes and the signing secret: the directory is mode 700, the files mode 600. Keep copies off the host.
### Restore
```sh
deploy/native/restore.sh /var/backups/ovpmon/20261005T101500Z # asks, stops, saves the current state, restores
It verifies the backup, stops the three application services, saves the **current state** to `/var/backups/ovpmon/<time>-pre-restore` (`OVPMON_NO_SAFETY_BACKUP=1` skips this), then restores code, databases, `/etc/ovpmon`, `/etc/openvpn`, PKI, client profiles, helper, service definitions, nginx site, UI and doas rules. A replaced database is kept as `<db>.failed-<time>`. OpenVPN is not stopped. On a new host run `install.sh` first, then `restore.sh`.
Manual equivalent (services stopped, paths for the default prefix):
```sh
B=/var/backups/ovpmon/20261005T101500Z
(cd$B&& sha256sum -c SHA256SUMS )
tar -xzpf $B/code.tar.gz -C /opt/OpenVPN-Monitoring-Simple # after moving the current APP_CORE and APP_PROFILER aside
tar -xzpf $B/easy-rsa.tar.gz -C /opt/OpenVPN-Monitoring-Simple/APP_PROFILER
tar -xzpf $B/client-config.tar.gz -C /opt/OpenVPN-Monitoring-Simple/APP_PROFILER
cp -p $B/db/profiler.db /var/lib/ovpmon/ovpn_profiler.db # the backup was made with the sqlite backup API
tar -xzpf $B/etc-ovpmon.tar.gz -C / && tar -xzpf $B/etc-openvpn.tar.gz -C /
tar -xzpf $B/system.tar.gz -C / # helper, service definitions, nginx site
```
A single database can also be put back from its migration copy `<db>.bak-<time>` in `/var/lib/ovpmon`: stop the services, copy it over the database, start the OLD release.
### Automatic rollback and `--rollback`
On any failure from phase 4 on: the services are stopped, **code, databases, `/etc/ovpmon`, `/etc/openvpn`, helper, doas rules, service definitions, nginx site and UI files are restored from the backup of this run**, the services are started and checked, and the result is reported with the backup path.
How the code is restored: the current (new or half-swapped) code directories are renamed to `<dir>.rollback-<time>`, `code.tar.gz` is extracted (old code **and old virtualenvs**, so no Internet is needed), and the PKI and client profiles, which the update never replaced, are moved back from the directory that held them. They are restored from `easy-rsa.tar.gz` / `client-config.tar.gz` only if they are missing. The failed databases are kept as `<db>.failed-<time>`. If the rollback itself fails the message says where the backup is and how to retry (`update.sh --rollback` or `restore.sh`).
`update.sh --rollback` does the same by hand from the newest `COMPLETE` backup after a confirmation, with one difference: PKI and client profiles come from the backup too (one consistent set with the databases), and the current state is saved first to `<time>-pre-restore`. Use it when an update succeeded but the new version misbehaves. Data created after that backup is lost (it is in the `-pre-restore` copy).
## Existing installations (adoption)
A host that was set up by hand (the layout of the old guide: code in `/opt/OpenVPN-Monitoring-Simple`, `/etc/ovpmon/env`, init scripts or units, helper and doas rules) can be updated with `update.sh`: it has no state file, so it is adopted and recorded after the first successful update. Files that these scripts do not manage are **left as they are**: init scripts, units, an nginx site and a doas file that do not carry the marker line `managed by ovpmon deploy/native` and differ from the shipped ones are only reported. The helper is replaced (the new one behaves like the old one without `helper.conf`), `helper.conf` is written when missing, and `OVPMON_RUNTIME`, `OVPMON_OPENVPN_SERVICE` and `OVPMON_OPENVPN_CONFIG` are added to the environment file only when absent. If the install directory is a git checkout (the source is the install directory), `git pull` changes the live files, therefore a rollback is armed from phase 2.
## What is preserved on update
| Item | On update |
|---|---|
| Databases | Kept in place, backed up twice (consistent copies), migrated additively with their own `<db>.bak-*` copy; restored automatically if the update fails after the stop |
| PKI (`APP_PROFILER/easy-rsa`): CA, keys, certificates, CRL | Moved, never replaced or deleted, backed up |
| Client profiles (`APP_PROFILER/client-config`) | Moved, never replaced or deleted, backed up |
| `/etc/ovpmon/env` (secret, DB paths) | Kept; only missing keys are added; copied into every backup |
| `/etc/ovpmon/helper.conf`, TLS certificate and key | Kept (helper.conf is rewritten only while it carries our marker and differs) |
| `/etc/openvpn` (`server.conf`, `crl.pem`, scripts, `ipp.txt`) | Not touched by the update; backed up |
| OpenVPN process and VPN sessions | Not stopped or restarted; connected users stay connected |
| `config.ini` of both components | Kept; the shipped one of the new version is saved as `config.ini.dist` when it differs |
| `profiler.log`, other `*.log` / `*.db` files below the code directories | Kept (moved) |
| Code, virtualenvs | **Replaced** (fresh virtualenvs; the old ones are in the backup) |
| UI files | Replaced with `--ui-dist` / `--build-ui`, or automatically when the committed build of the source differs from the installed one (`.ui-source-hash`); kept when there is no UI source; the previous ones are in the backup |
| Service definitions, nginx site, doas rules, helper | Replaced when they differ and are managed by these scripts; the previous ones are in the backup |
| User sessions | Stay valid while the secret is unchanged |
| Backups in `/var/backups/ovpmon` | The newest 5 kept, older ones pruned after a successful update; `-pre-restore` copies are never pruned automatically |
| Data directories (`/var/lib/ovpmon`, PKI, client profiles) | **Never deleted** by any script |
| `invalid --prefix ...` / `no valid install directory given` | The install directory must be a new or empty dedicated directory, not the repository checkout and not a system directory. Move or clone the repository elsewhere (for example `/root/ovpmon-src`) or choose another directory |
| `already installed ... use update.sh` / `an installation already exists` | `install.sh` never installs over an installation. Use `update.sh` (it adopts hand-made installations) |
| `installation stopped in phase ...` | Fix the cause and run `install.sh` again: it resumes and keeps secrets, certificate and data |
| `not a tested version ... needs --force` | Untested OS version: `install.sh --force` at your own risk |
| `ports ... already in use` | Another service uses 5001, 8000 or the HTTPS port: stop it or use `--https-port` |
| `pip install failed` | No access to the Python package index (proxy: `pip` honours `HTTPS_PROXY`); on Alpine check that `py3-pip` is installed |
| Health check fails | Alpine: `tail /var/log/ovpmon/ovpmon-api.log` (or `-gatherer`, `-profiler`); systemd: `journalctl -u ovpmon-api -n 50`. The scripts print the last lines of a failing service |
| `FATAL: ... newer than this version` / migration "too new" | The database was migrated by a newer release. Do not start the old version on it: update to the newer sources or restore a matching backup |
| Migration failed | Nothing was started and the rollback restored the databases; the report names the migration, the `<db>.bak-*` copy is in `/var/lib/ovpmon`. Keep the report |
| Profiler cannot start/stop OpenVPN, "helper failed" | The self-test warning of the scripts points at it: check the doas rules (`doas -C /etc/doas.conf` or `/etc/doas.d/ovpmon.conf`), `/etc/ovpmon/helper.conf` (must be `root:root` and not group/world writable; `su -s /bin/sh ovpmon -c "doas -n /usr/local/sbin/ovpmon-helper service status"` prints the reason) |
| `Configuration rejected` when generating the server config | The helper allowlist refused a directive, see [Privilege separation](../Changes/2026-09-30_Privilege_Separation.md) |
| OpenVPN does not start on Debian/Ubuntu | `systemctl status openvpn-server@server`, `journalctl -u openvpn-server@server`; the config must be `/etc/openvpn/server/server.conf` and `/dev/net/tun` must exist |
| Clients connect but have no internet | Forwarding or NAT is missing: see the firewall section |
| nginx: `conflicting server name` / port in use | Another site uses the same port; change `--https-port` (or the `listen` line of the site and reload) |
| Browser warns about the certificate | It is self-signed; check the fingerprint printed by `install.sh`, or install a real certificate under `/etc/ovpmon/tls/` and reload nginx |
| `no UI source found` (install stops) | The checkout has no `deploy/ui-dist` (incomplete clone, or the maintainer did not publish it) and no `--ui-dist`. Use `--build-ui` (Docker or Node 20.19+; `--node-download` on Debian/Ubuntu), `--ui-dist FILE\|DIR` from another machine, or `--no-ui` for a placeholder page |
| Warning "committed UI build ... is OLDER than the APP_UI sources" | Someone changed `APP_UI` without refreshing the build. Maintainers: `deploy/native/build-ui.sh --publish` and commit `deploy/ui-dist`. On the host: `--build-ui` |
| `the installed Node is too old` / `node and npm are not installed` (`--build-ui`, `build-ui.sh --local`) | The message lists the commands for the OS: Alpine `apk add nodejs npm`; Debian/Ubuntu `--node-download` or Node 20+ from nodejs.org |
| UI shows the placeholder page | Installed with `--no-ui`: run `deploy/native/update.sh` (installs the UI of the repository), or add `--ui-dist` / `--build-ui` |
| `su`/`doas` self-test fails on a minimal container | Containers often lack `/etc/pam.d/doas` or a real init system; the services may still work (check health) |
## Host hardening (recommended, not done by the scripts)
- SSH: key-only (`PasswordAuthentication no`, `KbdInteractiveAuthentication no`, `PermitRootLogin prohibit-password`). Cloud-init drop-ins in `/etc/ssh/sshd_config.d/` can override the main file, so put your settings in a file that sorts first, for example `00-hardening.conf`.
- fail2ban: jails `sshd` and one for `POST /api/auth/login` (HTTP 401/429/503) on the nginx access log.
- Backends are bound to `127.0.0.1`; only the HTTPS port and the VPN port should be reachable from outside.
- Keep the system updated (`apk upgrade` / `apt-get upgrade`) and watch the advisories of OpenVPN, nginx and OpenSSH.
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"
```
## Security notes
- Services run as `ovpmon` (no login shell); code and virtualenvs are root-owned and read-only for them. systemd units add `PrivateTmp`, `ProtectHome`, `ProtectSystem=full`, kernel and cgroup protection; `ovpmon-api` and `ovpmon-gatherer` also set `NoNewPrivileges`. `ovpmon-profiler` must **not** (it calls the setuid `doas`), must not use seccomp-based options either (`ProtectKernelTunables`, `ProtectKernelModules`, `RestrictRealtime`, `LockPersonality`, `SystemCallFilter`, ...): for an unprivileged unit systemd then sets NoNewPrivileges implicitly and `doas` fails with "not installed setuid" (check: `grep NoNewPrivs /proc/<main pid>/status` must show 0). It keeps `/etc/openvpn` writable, because the helper runs inside the profiler's mount namespace.
- The helper accepts six fixed commands, validates `server.conf` against an allowlist and reads its own root-owned configuration; nothing else runs as root. `ovpmon` owns the PKI including the CA key: a compromised profiler can issue client certificates (VPN access) but cannot become root.
-`/etc/ovpmon/env` is `root:root` 600 and never printed; the generated administrator password is shown once and removed from the file after the first start.
- Backups contain private keys, password hashes and the secret: mode 700/600, keep off-host copies encrypted.
- Both APIs listen on `127.0.0.1`; only nginx (HTTPS) and OpenVPN are reachable. Replace the self-signed certificate when a domain is available; consider restricting the UI by address or reaching it through the VPN.
- The scripts do not harden SSH or install fail2ban: see the next section.