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>
7.4 KiB
System services: reference
Paths and owners, the environment file, the root helper configuration and security notes. Install: System services.
Layout: what is where, who owns it
| Item | Path | Owner, mode |
|---|---|---|
| Code | <prefix>/APP_CORE, <prefix>/APP_PROFILER |
root:root, read-only for others |
| Virtualenvs | <prefix>/APP_CORE/venv, <prefix>/APP_PROFILER/venv |
root:root |
| PKI (CA, keys, certificates, CRL) | <prefix>/APP_PROFILER/easy-rsa (real directory) |
ovpmon:ovpmon 750 |
| Client profiles | <prefix>/APP_PROFILER/client-config (real directory) |
ovpmon:ovpmon 750 |
| Profiler log | <prefix>/APP_PROFILER/profiler.log |
ovpmon:ovpmon 640 |
| Shipped settings file | <prefix>/APP_CORE/config.ini, <prefix>/APP_PROFILER/config.ini |
root:root; the environment file overrides it |
| Databases | /var/lib/ovpmon/openvpn_monitor.db, ovpn_profiler.db, migration copies *.db.bak-* |
ovpmon:ovpmon |
Staging of server.conf |
/var/lib/ovpmon/staging/ |
ovpmon:ovpmon 750 |
| Service environment | /etc/ovpmon/env |
root:root 600 |
| Helper configuration | /etc/ovpmon/helper.conf |
root:root 644 |
| TLS certificate and key | /etc/ovpmon/tls/ovpmon.crt, ovpmon.key |
root:root (key 600) |
| Deployment state | /etc/ovpmon/deploy.state |
root:root 644 |
nftables ruleset of the VPN clients (only after firewall.sh) |
/etc/ovpmon/nftables.nft, service ovpmon-nft |
root:root 644 |
| Root helper | /usr/local/sbin/ovpmon-helper |
root:root 755 |
| doas rules | Alpine: /etc/doas.d/ovpmon.conf; Debian/Ubuntu: block in /etc/doas.conf |
root:root |
| OpenVPN configuration | /etc/openvpn/server.conf (Alpine) or /etc/openvpn/server/server.conf, /etc/openvpn/crl.pem, /etc/openvpn/scripts/ |
root:root |
| OpenVPN logs | /var/log/openvpn/openvpn.log, openvpn-status.log (root:ovpmon 640) |
root |
| Service logs | /var/log/ovpmon/ (OpenRC) or the journal (systemd) |
ovpmon / systemd |
| UI files | /var/www/ovpmon |
root:root |
| Backups | /var/backups/ovpmon/<UTC timestamp>/ |
root:root 700 |
| Deployment log | /var/log/ovpmon-deploy.log |
root:root 600 |
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_DB_PATH |
/var/lib/ovpmon/openvpn_monitor.db |
monitoring database |
OVPMON_PROFILER_DB_PATH |
/var/lib/ovpmon/ovpn_profiler.db |
profiler database |
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 | Alpine (written) | Debian/Ubuntu (written) | Rule |
|---|---|---|---|
install_dir |
/opt/OpenVPN-Monitoring-Simple |
same | absolute, no ..; the PKI is <install_dir>/APP_PROFILER/easy-rsa/pki |
service_manager |
openrc |
systemd |
openrc or systemd |
service_unit |
openvpn |
openvpn-server@server |
^[A-Za-z0-9@._-]{1,64}$, not starting with - or . |
config_path |
/etc/openvpn/server.conf |
/etc/openvpn/server/server.conf |
absolute, below /etc/openvpn/, ends with .conf |
staged_path |
/var/lib/ovpmon/staging/server.conf |
same | absolute, below /var/lib/ovpmon/ |
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.
Security notes
- Services run as
ovpmon(no login shell); code and virtualenvs are root-owned and read-only for them. systemd units addPrivateTmp,ProtectHome,ProtectSystem=full, kernel and cgroup protection;ovpmon-apiandovpmon-gathereralso setNoNewPrivileges.ovpmon-profilermust not (it calls the setuiddoas), must not use seccomp-based options either (ProtectKernelTunables,ProtectKernelModules,RestrictRealtime,LockPersonality,SystemCallFilter, ...): for an unprivileged unit systemd then sets NoNewPrivileges implicitly anddoasfails with "not installed setuid" (check:grep NoNewPrivs /proc/<main pid>/statusmust show 0). It keeps/etc/openvpnwritable, because the helper runs inside the profiler's mount namespace. - The helper accepts six fixed commands, validates
server.confagainst an allowlist and reads its own root-owned configuration; nothing else runs as root.ovpmonowns the PKI including the CA key: a compromised profiler can issue client certificates (VPN access) but cannot become root. /etc/ovpmon/envisroot:root600 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.
Related: Database migrations, Privilege separation, Containers, Deployment plan.