Repository navigation
fix(monitoring): drop basic auth in front of beszel - #92
Merged
Merged
Conversation
The Beszel UI sends its own token in the Authorization header on every API call. Caddy's basic auth rejected it with WWW-Authenticate: Basic, so the browser asked for the monitoring password again and again. Beszel's own login now protects it. Its account is created on the first start from BESZEL_ADMIN_EMAIL / BESZEL_ADMIN_PASSWORD, which the installer and setup.sh generate, and Caddy refuses /api/beszel/create-user so nobody can claim the UI from the browser. Installs from before keep their Beszel account; the docs explain how to recover a lost password. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 11
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In production, the monitoring page kept showing the browser's login prompt, even after logging in to Beszel.
The Beszel UI sends its own session token in the
Authorizationheader on every API call. That replaces the basic auth credentials, so Caddy answers401withWWW-Authenticate: Basic, and the browser asks again. Reproduced locally with Caddy + Beszel 0.21.0: log in through basic auth, then any API call with the Beszel token →401 Www-Authenticate: Basic realm="restricted". Basic auth in front of Beszel cannot work.Fix
/api/beszel/create-useris refused (403): when Beszel has no account yet, nobody can create the first one from the browser..envon Beszel's first start (BESZEL_ADMIN_EMAIL/BESZEL_ADMIN_PASSWORD→ Beszel'sUSER_EMAIL/USER_PASSWORD). Checked: Beszel reads them only when its data is empty and ignores them afterwards.MONITORING_PASSWORD_HASHwithout a Beszel login): they keep their Beszel account, and nothing is generated or asked;setup.sh: generates the same login.beszel superuser upsert, then/_/);.envbefore the first start;MONITORING_USER/MONITORING_PASSWORD_HASHare no longer used; leftover values are ignored.Upgrading an existing install
git pull, thendocker compose -f docker-compose.prod.yml up -dto recreate Caddy. Log in with the Beszel account you already created.Test plan
.envaccount 200, API call with the Beszel token 200 and noWWW-Authenticate,create-userfrom outside 403create-user404 once an account existssuperuser upsert→ superuser login → user password reset → user login with the new password;/_/reachable through Caddy--yesrefuses a shortMONITORING_PASSWORD,.envwritten with the login or commented for legacy installscaddy validate,docker compose config(env passed through), shellcheck (warning level) oninstall.sh/setup.sh, docs build🤖 Generated with Claude Code