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>
This commit is contained in:
1 parent
f95a0b63e6
commit
ad6995bb63
85 files changed
+2805
-1280
No files matched your search
+12
-1
@@ -22,7 +22,7 @@
|
||||
# started on an unmigrated database), 6 UI, nginx, helper, doas rules, service definitions, 7 START and health
|
||||
# checks. A failure after the stop triggers an automatic rollback from the backup of this run.
|
||||
# The PKI (easy-rsa), client profiles and databases are never replaced or deleted by an update.
|
||||
# See DOCS/Deployment/Scenario2_System_Services.md and DOCS/General/Database_Migrations.md
|
||||
# See DOCS/Deployment/System_Services/README.md and DOCS/General/Database_Migrations.md
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
@@ -456,6 +456,17 @@ main() {
|
||||
done
|
||||
svc_defs_reload
|
||||
for _s in $SERVICES; do svc_enable "$_s" || warn "could not enable $_s at boot"; done
|
||||
# JWT key: the APIs refuse to start with a missing or weak key, so one is issued here, before the start.
|
||||
# The env file is part of the backup, a failed update restores the previous one.
|
||||
if ! _reason=$(secret_problem "$(env_get OVPMON_API_SECRET_KEY)"); then
|
||||
_new_key=$(openssl rand -hex 32 2>/dev/null || true)
|
||||
[ "${#_new_key}" -eq 64 ] || _new_key=$(od -An -N32 -tx1 /dev/urandom | tr -d ' \n')
|
||||
[ "${#_new_key}" -eq 64 ] || die "cannot generate a random JWT key"
|
||||
kv_set "$ENV_FILE" OVPMON_API_SECRET_KEY "$_new_key" 600
|
||||
unset _new_key
|
||||
warn "OVPMON_API_SECRET_KEY in $ENV_FILE was $_reason: a new random key was issued. ALL USER SESSIONS ARE RESET: everyone has to sign in again"
|
||||
CHANGES=$((CHANGES + 1))
|
||||
fi
|
||||
# environment: add the settings of this version when they are missing (existing values are never changed)
|
||||
for _kv in "OVPMON_RUNTIME=host" "OVPMON_OPENVPN_SERVICE=$OVPN_SERVICE" "OVPMON_OPENVPN_CONFIG=$OVPN_CONFIG"; do
|
||||
_k=${_kv%%=*}
|
||||
|
||||
Reference in new issue
Block a user