Optional RBAC
ChannelWatch supports optional role-based access control. It stays disabled by default so single-user home lab deployments can keep using the shared API key with no extra setup. When enabled, it adds named users, browser sessions, and three distinct roles so you can share dashboard access without giving everyone full control.
| Role | What they’ll be able to do |
|---|---|
| Admin | Full access: manage DVR servers, change settings, manage users, rotate credentials, view all data |
| Operator | Configure alerts and notification providers, view all dashboard data, but cannot manage users or rotate the encryption key |
| Viewer | Read-only access to the dashboard and activity history. Cannot change any settings |
Enabling RBAC
Section titled “Enabling RBAC”The current backend computes and reports three security modes from actual settings state:
- Make sure you have at least one admin user configured before enabling RBAC, or use the environment variable bootstrap described below.
- Flip the Enable RBAC toggle in Settings > Security.
- If a shared API key is still configured, the security mode becomes
RBAC_WITH_API_KEY_FALLBACK, meaning browser sessions and role checks are active but the API key still works as a bypass. - If you remove the shared API key after creating an admin account, the mode becomes
RBAC_ONLY.
Creating the first admin user
Section titled “Creating the first admin user”The current source supports two bootstrap paths for the initial admin account.
Option 1: Environment variables (recommended for automation)
Section titled “Option 1: Environment variables (recommended for automation)”Set CW_ADMIN_USER and CW_ADMIN_PASS before the first startup with RBAC enabled:
environment: CW_ADMIN_USER: "admin" CW_ADMIN_PASS: "your-strong-password"On startup, ChannelWatch checks whether any users exist. If none do, it creates an admin account using these credentials. The environment variables are not stored after the account is created, so you can remove them from your compose file after the first run.
Option 2: Setup flow
Section titled “Option 2: Setup flow”If RBAC is enabled and no users exist, the auth API exposes setup status and first-user creation endpoints:
GET /api/v1/auth/setup-statusPOST /api/v1/auth/setupThat setup flow is what lets the UI prompt for the first admin username and password before regular session login can take over.
This path works well for interactive setups where you’re at the keyboard during first launch.
Managing users
Section titled “Managing users”Once logged in as an admin, ChannelWatch’s shipped RBAC model is designed around these role boundaries:
- Add new users and assign roles
- Change a user’s role
- Reset a user’s password
- Disable or delete a user
There will be no limit on the number of users.
Verifying the active mode
Section titled “Verifying the active mode”The security mode badge in the top-right corner of every page shows the current state. After enabling RBAC, it reflects whether the shared API key is still present.
You can also check the current state via the API:
GET /api/v1/security/statusLook for "security_mode": "RBAC_ONLY" and "api_key_fallback_active": false to confirm the shared-key bypass is no longer active.
Lockout recovery
Section titled “Lockout recovery”If you lose access before any user exists, you can recover by setting CW_ADMIN_USER and CW_ADMIN_PASS environment variables and restarting the container. ChannelWatch creates the bootstrap admin only when the user table is empty.
environment: CW_ADMIN_USER: "admin" CW_ADMIN_PASS: "new-recovery-password"After recovery, remove the environment variables and restart again to avoid leaving credentials in your compose file.
Session security
Section titled “Session security”Browser sessions in the current RBAC flow use a channelwatch_session cookie plus an X-CSRF-Token header for mutating requests. In source, the session cookie is set with HttpOnly, Secure, SameSite=Strict, and a max_age of 86400 seconds.
RBAC and the API key
Section titled “RBAC and the API key”When RBAC is active, the relationship between the API key and roles will depend on the security mode:
RBAC_WITH_API_KEY_FALLBACK: The API key bypasses all role checks. Any request with a valid API key has full admin-equivalent access.RBAC_ONLY: The API key is disabled. All requests must authenticate as a named user. Automation that previously used the API key must be updated to use a service account with an appropriate role.
See Security Modes for a full explanation of the three modes and when to use each.
Multi-user deployments
Section titled “Multi-user deployments”The intended workflow for a shared deployment:
- Create the first admin account using env vars or the setup wizard.
- Enable RBAC in Settings > Security.
- Create Viewer or Operator accounts for other household members or team members.
- Optionally disable the API key fallback to enforce strict role separation.
- Update any automation scripts to use a service account with an appropriate role instead of the shared API key.
Related pages
Section titled “Related pages”- Security Modes — the three modes and the security badge
- API Keys (encrypted) — how DVR credentials are stored
- CSP, CSRF, Cookies — web hardening defaults