feat: add new Prometheus metrics and bearer token auth for /metrics
Add 6 new Prometheus metrics for richer observability: - auth_attempts_by_country_total (counter by country) - commands_executed_total (counter by shell via OnCommand callback) - human_score (histogram of final detection scores) - storage_login_attempts_total, storage_unique_ips, storage_sessions_total (gauges via custom collector querying GetDashboardStats on each scrape) Add optional bearer token authentication for the /metrics endpoint via web.metrics_token config option. Uses crypto/subtle.ConstantTimeCompare. Empty token (default) means no auth for backwards compatibility. Also adds "cisco" to pre-initialized session/command metric labels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,7 @@ Key settings:
|
||||
- `web.listen_addr` — web dashboard listen address (default `:8080`)
|
||||
- Session detail pages at `/sessions/{id}` include terminal replay via xterm.js
|
||||
- `web.metrics_enabled` — expose Prometheus metrics at `/metrics` (default `true`)
|
||||
- `web.metrics_token` — bearer token to protect `/metrics`; empty means no auth (default empty)
|
||||
- `detection.enabled` — enable human detection scoring (default `false`)
|
||||
- `detection.threshold` — score threshold (0.0–1.0) for flagging sessions (default `0.6`)
|
||||
- `detection.update_interval` — how often to recompute scores (default `5s`)
|
||||
|
||||
Reference in New Issue
Block a user