Files
OpenVPN-Monitoring-Simple/DOCS/General/Configuration.md
T
ayurishchevandClaude Sonnet 5.5 ad6995bb63 Docs restructure, code review, gatherer reliability, JWT key fail-closed
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>
2026-10-05 20:30:45 +03:00

29 lines
2.3 KiB
Markdown

# Configuration
Each component reads `config.ini` (shipped in `APP_CORE/` and `APP_PROFILER/`); any value can be overridden by an environment variable `OVPMON_{SECTION}_{KEY}`. The installation scripts write the environment for you, so a newcomer normally changes nothing here.
## Variables
| Variable | Purpose |
|---|---|
| `OVPMON_API_SECRET_KEY` | JWT signing key shared by both APIs (**must be random**; changing it logs everybody out; keep it across updates) |
| `OVPMON_INITIAL_ADMIN_USER` / `_PASSWORD` | one-time seed of the first administrator (only while the users table is empty); the scripts remove it after the first start |
| `OVPMON_CORS_ORIGINS` | extra allowed CORS origins, comma-separated (empty = same-origin only) |
| `OVPMON_OPENVPN_MONITOR_DB_PATH` | monitoring database |
| `OVPMON_PROFILER_DB_PATH` | profiler database |
| `OVPMON_OPENVPN_MONITOR_LOG_PATH` | path of `openvpn-status.log` |
| `OVPMON_LOGGING_LEVEL` | `INFO` / `DEBUG` |
## JWT signing key rule
The key comes from `OVPMON_API_SECRET_KEY` or, when the variable is not set, from `[api] secret_key` in `config.ini` (the variable wins). There is **no built-in default**: the shipped `config.ini` files have an empty value. A key is accepted when it is not blank, does not contain `change-me` or `changeme` (any case) and has at least 32 characters (`openssl rand -hex 32` gives 64). With a missing or weak key both APIs refuse to start: they log a critical message (never the key itself) naming the reason and the source, and exit with code 1. Both APIs must get the same key. `OVPMON_SECRET_KEY` (a name used by older guides) is **not read**; if it is set instead of `OVPMON_API_SECRET_KEY`, the message says to rename it.
## Where the values are set
| Installation method | File | Reference |
|---|---|---|
| Containers | `.env` next to the compose files (`JWT_SECRET` is mapped to `OVPMON_API_SECRET_KEY`) | [Containers: reference](../Deployment/Containers/Reference.md) |
| System services | `/etc/ovpmon/env` (`root:root`, mode 600) plus `/etc/ovpmon/helper.conf` for the root helper | [System services: reference](../Deployment/System_Services/Reference.md) |
The OpenVPN server settings (port, network, routes, DNS, PKI parameters) are not set here: they are edited in the UI (**VPN** and **PKI** pages) and validated before use.