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
@@ -18,15 +18,15 @@ This includes:
|
||||
## Proposed Changes
|
||||
|
||||
### Backend (Python/Flask)
|
||||
#### [MODIFY] [requirements.txt](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_CORE/requirements.txt)
|
||||
#### [MODIFY] [requirements.txt](../../APP_CORE/requirements.txt)
|
||||
- Add `pyjwt`, `pyotp`, `qrcode`, `bcrypt`, `flask-bcrypt` (or `werkzeug.security`).
|
||||
|
||||
#### [MODIFY] [db.py](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_CORE/db.py)
|
||||
#### [MODIFY] [db.py](../../APP_CORE/db.py)
|
||||
- Update `init_database` to create:
|
||||
- `users` table: `id`, `username`, `password_hash`, `totp_secret`, `is_2fa_enabled`.
|
||||
- `login_attempts` table (for brute-force protection): `ip_address`, `attempts`, `last_attempt`.
|
||||
|
||||
#### [MODIFY] [openvpn_api_v3.py](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_CORE/openvpn_api_v3.py)
|
||||
#### [MODIFY] [openvpn_api_v3.py](../../APP_CORE/openvpn_api_v3.py)
|
||||
- **New Imports**: `jwt`, `pyotp`, `functools.wraps`.
|
||||
- **Helper Functions**:
|
||||
- `check_rate_limit(ip)`: Verify login attempts.
|
||||
@@ -37,27 +37,28 @@ This includes:
|
||||
- `POST /api/auth/setup-2fa`: Generate secret & QR code.
|
||||
- `POST /api/auth/enable-2fa`: Confirm and save secret.
|
||||
- **Protect Routes**: Apply `@token_required` to all existing API routes (except auth).
|
||||
- **Signing key (fail closed)**: tokens are signed with `OVPMON_API_SECRET_KEY` (or `[api] secret_key`); there is no built-in default. A missing, blank, placeholder (`change-me`/`changeme`) or shorter than 32 characters key stops the API at start (critical log without the key, exit code 1, before the database is opened). The same rule is checked by the install and update scripts. See [Configuration](Configuration.md).
|
||||
|
||||
### Frontend (Vue.js)
|
||||
#### [NEW] [Login.vue](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_UI/src/views/Login.vue)
|
||||
#### [NEW] [Login.vue](../../APP_UI/src/views/Login.vue)
|
||||
- Login form (Username/Password).
|
||||
- 2FA Input (conditional, appears if server responses "2FA required").
|
||||
|
||||
#### [NEW] [Setup2FA.vue](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_UI/src/views/Setup2FA.vue)
|
||||
#### [NEW] Setup2FA.vue (planned; the 2FA setup lives in `Account.vue`)
|
||||
- Screen to show QR code and verify OTP to enable 2FA for the first time.
|
||||
|
||||
#### [MODIFY] [router/index.js](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_UI/src/router/index.js)
|
||||
#### [MODIFY] [router/index.js](../../APP_UI/src/router/index.js)
|
||||
- Add `/login` route.
|
||||
- Add global `beforeEach` guard:
|
||||
- Check if route `requiresAuth`.
|
||||
- Check if token exists in `localStorage`.
|
||||
- Redirect to `/login` if unauthorized.
|
||||
|
||||
#### [MODIFY] [App.vue](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_UI/src/App.vue)
|
||||
#### [MODIFY] [App.vue](../../APP_UI/src/App.vue)
|
||||
- Add `Logout` button to the sidebar.
|
||||
- Conditionally render Sidebar only if logged in (optional, or just redirect).
|
||||
|
||||
#### [MODIFY] [main.js](file:///Users/tstark/Documents/ovpmon_simple_gitea/APP_UI/src/main.js)
|
||||
#### [MODIFY] [main.js](../../APP_UI/src/main.js)
|
||||
- Setup `axios` interceptors:
|
||||
- **Request**: Add `Authorization: Bearer <token>`.
|
||||
- **Response**: On `401 Unauthorized`, clear token and redirect to `/login`.
|
||||
|
||||
Reference in new issue
Block a user