docs(auth): describe the login budget and its limits

Also corrects cli.md, which said MFA is required for everyone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-05 06:27:39 -03:00
1 parent 0e4e8cc37e
commit b7fd1b7c8a
8 files changed
+85 -35

No files matched your search

+22 -9
View File
@@ -27,15 +27,28 @@ reproduction when a private channel is available.
credential are `GET /api/health`, `GET /api/auth/state`, `POST /api/auth/{bootstrap,login,mfa,password-change-required}` and the login assets (`/login.html`, `/login.js`, `/app.css`, `/logo.png`, `/i18n.js`, `/i18n-en.js`). Sessions, API tokens (`read`/`admin`) and an audit log are kept
in the data directory. A password or MFA change revokes admin tokens and keeps
read tokens. `/api/analyze` is admin-only.
- **Attempt limits:** wrong passwords count per username and client address, so
one address cannot lock the owner out from another; counts fade by one every 15
minutes. Past 100 failures on one username from any address, every address waits
60 s for its turn and then backs off with no free attempts: this delays guessing
spread over many addresses without letting it block the owner. It slows a large
botnet but does not stop it, so long passwords and MFA remain the real defense.
These counts are in memory and a restart clears them. MFA codes and session
password checks use a separate persistent per-user count, reachable only past
the password or from a live session.
- **Attempt limits:** wrong passwords count per username and client address
(an IPv4 address or an IPv6 /48), and an address also has its own overall limit;
counts fade by one every 15 minutes. On top of that each username has a budget of
100 failures per rolling 24 hours from addresses it has not logged in from, fading
by one every 14.4 minutes. Once spent, attempts from unknown addresses are refused
before the password is evaluated, even with the right password. Usernames with no
account behave the same. An address with a completed login (after MFA, if
required) in the last 30 days skips the budget but not the per-address limit; each
account keeps at most 10, as hashes rather than addresses, cleared by a password
change, an MFA change or `acaua auth reset`.
**The limit that remains:** an attacker can stop logins from a *new* address for
a real user for the whole budget window, and for as long as they keep spending the
slots as they fade. Known addresses, existing sessions and API tokens keep working,
and `acaua auth reset` clears the budget; an attacker still running can spend it
again. Up to 100 guesses a day per account remain possible, so long passwords
matter, and MFA remains recommended for analysts.
Crossing the budget writes one `login.budget_exhausted` audit event per account
per 24 hours. The audit log has no rotation yet: failed logins add to it, so watch
its size on an exposed instance. Budgets of real accounts survive a restart;
per-address counts are in memory and a restart clears them. MFA codes and session
password checks use a separate persistent per-user count, reachable only past the
password or from a live session.
- **Browser headers:** every response has a CSP (`script-src 'self'`,
`frame-ancestors 'none'`), `X-Frame-Options: DENY`, `nosniff` and
`Referrer-Policy: no-referrer`. `style-src` allows `'unsafe-inline'`, which the