feat(settings): add browser setup and administration (#10)

This commit is contained in:
Florian Schmidt
2026-11-16 10:15:04 +01:00
parent 4fe7e4e376
commit 02a22bef40
20 changed files with 939 additions and 24 deletions
+12 -5
View File
@@ -15,9 +15,11 @@ LAN/Tailscale addresses. No password is set initially: API access fails closed.
`SHELLBOOK_PORT`, `SHELLBOOK_TRUSTED_PROXIES` (comma-separated proxy IPs),
and `TS_AUTHKEY` in the host environment. Auth keys are transferred in a
mode-0600 temporary file and removed, never stored in the service env.
3. In the CT run the printed password command. It also accepts one password
line on stdin; do not pass passwords as arguments. Source-checkout command:
`SHELLBOOK_DATA_DIR=/var/lib/shellbook pnpm --filter @shellbook/server set-password`.
3. Open ShellBook in your browser. In the CT run `cat /var/lib/shellbook/setup-token`
and enter the token with a new password (at least 12 characters) in the setup screen.
This token is private, survives restart, and is deleted after setup. It is never logged.
Alternative password CLI: `SHELLBOOK_DATA_DIR=/var/lib/shellbook pnpm --filter @shellbook/server set-password`
from the checkout (hidden prompt or one password line on stdin; never arguments).
4. Run `claude` as shellbook and use `/login`. Authorize
`/home/shellbook/.ssh/id_ed25519.pub` on managed hosts. The service user has
no sudo access. Initialize notebooks manually if templates were absent.
@@ -36,8 +38,13 @@ leaves the running service in place. Check `journalctl -u shellbook`.
Configuration is `/etc/shellbook/env`; data is `/var/lib/shellbook` (back it up
along with workspace and service-user home). `SHELLBOOK_SESSION_SECONDS` defaults
to 2592000 (30 days). Cookies survive restart. Logout clears the browser cookie;
password changes do not revoke existing cookies. For emergency revocation stop
the service, delete `session-secret` from the data directory and start it again.
Settings supports changing the password and signing out all sessions; both revoke
older cookies and close active WebSockets, while the current browser receives a fresh
cookie. CLI password changes invalidate cookies on their next request. For emergency
revocation stop the service, delete `session-secret`, and restart it.
Settings also shows paths, versions, and Claude CLI status, and opens the terminal
for `claude` then `/login` as the service user. A credentials file's existence is only
a hint, not proof that a login is valid.
Forward auth is off by default. To enable it set
`SHELLBOOK_FORWARD_AUTH_HEADER=Remote-User` and trusted proxy IPs. The header is