Admin Hardening
Guides, route-group overviews, and live schema entry points for the Plexichat backend.
Harden the admin surface
This guide describes how to lock down the admin UI and API. Apply these settings before you expose the server beyond localhost.
Admin authentication
Admin routes use opaque sessions, not JWTs. Every state-changing or sensitive read operation requires the matching
require_admin_permissionscope (src/api/routes/admin/utils.py). Scopes are defined insrc/core/admin/permissions.py.Wildcard permissions such as
*are rejected (src/core/servers/permission_utils.py). Grant each permission explicitly.Require OTP for the admin UI:
admin_ui: require_otp: true force_password_change_first_login: true session_timeout_minutes: 480 max_concurrent_sessions: 3
Network restrictions
Restrict the admin UI to loopback by default and add explicit allow-lists only when needed:
admin_ui:
host_restriction:
enabled: true
allowed_hosts: ["127.0.0.1", "localhost", "::1"]
allowed_origins: []
blocked_ips: []
- Keep
tls.enabled: falseonly for local development. For production, settls.enabled: trueand configuretls.cert_pathandtls.key_path(src/config_defaults.py). - The server binds to
127.0.0.1:8000by default (server.hostinsrc/config_defaults.py). Put a reverse proxy in front of it and forward only trustedX-Forwarded-Forvalues.
Rate limiting and approvals
Global rate limits default to
25000requests per60s, user10000, and IP5000(src/config_defaults.py). Keeprate_limiting.enabled: truein production.Gate destructive actions with the approval workflow:
admin_ui: approval_workflows: enabled: true approval_required_admins: 2 approval_timeout_hours: 48 require_approval_for: - users.force_purge - users.delete - servers.deleteRequests that need approval return
202until a second admin approves them.
Sensitive data handling
- Treat
%,_, and\literally in search queries. Do not interpret them as wildcards. - Scheduled-deletion timestamps are in milliseconds. Admin database adapters may return mapping or tuple rows — handle both shapes.
- The API never returns filesystem paths, SQL errors, or raw exception text. Internal errors are logged server-side and surfaced as generic messages.
- Audit-sink failures are emitted through structured logging, not
stdout. - Reindex status uses the same permission gate as reindex execution, and its in-progress claim is lock-protected.
Audit and retention
admin_ui:
audit:
log_to_file: true
log_to_database: true
sensitive_actions_always_db: true
retention_days: 365
Review audit logs regularly and forward them to your SIEM.
Voice and media
- The SFU backend defaults to
aiortc(voice.sfu_backendinsrc/config_defaults.py). Change it only if you operatemediasouporjanus. - File uploads are scanned when
media.scanner_enabledis true andSCANNER_HOSTpoints at theclamavservice (docker-compose.yml). - External media goes through
GET /api/v1/media/proxy?url=...(src/api/routes/media.py) with SSRF validation. Do not expose RustFS directly.
Gateway and health
- The WebSocket gateway is
ws://host/gateway(src/api/websocket/gateway.py(gateway_endpoint)), not/ws. - Use
GET /api/v1/readyfor liveness andGET /api/v1/healthfor detailed checks (src/api/routes/health.py). Both live under the API prefix (src/config_defaults.py).
Next steps
- Set
PLEXICHAT_SYSTEM_KEYor protect~/.plexichatkey material — losing it makes encrypted data unrecoverable. - Configure the
backupservice for daily restic snapshots (seedocker/README.md). - Review
docs/security.mdanddocs/configuration.mdfor the full option reference.