| **Local backup packages** (Backup and Restore page), `ovpmon_backup.db` | `/var/lib/ovpmon/backups/` (created by the service, folders 700, files 600; root set by `OVPMON_BACKUP_LOCAL_ROOT`), `/var/lib/ovpmon/ovpmon_backup.db` (included in the host backup as `db/backupcfg.db`; the packages folder is not) | `ovpmon:ovpmon` |
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; at least 32 characters, no `change-me`/`changeme` (the APIs refuse to start otherwise); changing it logs everybody out; keep it across updates. `update.sh` issues a new random key when it is missing or weak and resets all sessions |
| `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.
`KEY=VALUE` lines written by `install.sh` and `update.sh`; `update.sh` reads them back.
| Key | Meaning |
|---|---|
| `OVPMON_PREFIX` | install directory |
| `OVPMON_HTTPS_PORT` | HTTPS port of the nginx site |
| `OVPMON_CSP_CONNECT_EXTRA` | extra origins of the CSP `connect-src` in the nginx site (`install.sh` / `update.sh --csp-connect-extra`); empty = same origin only. Validated: `https://host[:port]` or `http://host[:port]` separated by spaces |
| `OVPMON_OS`, `OVPMON_VERSION`, `OVPMON_INSTALLED_AT`, `OVPMON_LAST_UPDATE` | information |
| `FIREWALL_*` | settings of `firewall.sh`, see [Firewall](Firewall.md) |
- 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 [Host hardening](Troubleshooting.md#host-hardening-recommended-not-done-by-the-scripts).