Add two-factor login (TOTP) with recovery codes

Users can set up an authenticator app from their account page; login
then asks for a code after the password, with one-time recovery codes
as a fallback. Sensitive actions (tokens, user changes, 2FA resets)
need a code from the last 5 minutes. totp.require (none/admins/all)
forces setup, and admins can reset a user's 2FA from the UI, the jarl
CLI or jarld on the server. The dashboard and jarl status flag users
missing 2FA and a shared "admin" account still in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
abrown38andClaude Opus 5.5 committed 2026-10-09 14:12:24 +00:00
1 parent b22ffee1bb
commit 8f9cdd0a17
35 files changed
+1965 -43

No files matched your search

+6 -2
View File
@@ -43,6 +43,10 @@ error: www.adbraun.lol has a CNAME, so it can't have any other records (found A)
using it).
Passwords use argon2id, sessions have CSRF protection, logins are rate
limited.
* **Two-factor login** with any authenticator app (TOTP), with recovery
codes; optional per user, or required for administrators or everyone
(`totp.require`). With it on, creating API tokens and changing users
asks for a fresh code, so a stolen password can't be turned into a token.
* **Audit log** of every login, change and token, with user, token, IP and
outcome.
* **Daily backups** of the database by a systemd timer, checked as they are
@@ -99,7 +103,7 @@ in `/etc/jarl/jarl.yaml` to reach it from your management network.
| [docs/configuration.md](docs/configuration.md) | `/etc/jarl/jarl.yaml` reference |
| [docs/cli.md](docs/cli.md) | The `jarl` command line client |
| [docs/api.md](docs/api.md) | REST API reference |
| [docs/permissions.md](docs/permissions.md) | Users, tokens, grants and roles |
| [docs/permissions.md](docs/permissions.md) | Users, tokens, grants and roles, two-factor login |
| [docs/views.md](docs/views.md) | Split DNS: adding views to a server that has none |
| [docs/acme.md](docs/acme.md) | Let's Encrypt DNS-01 with certbot, acme.sh, lego and Traefik |
| [docs/stats.md](docs/stats.md) | Query statistics: enabling, what is collected, retention |
@@ -133,7 +137,7 @@ these pages:
* **Changes**: pending edits with the diff, named-checkconf output and
problems, applied as one changeset. History lists applied changesets with
their diffs and a revert button.
* **Audit, Users, Account** (password, API tokens) and **Search**.
* **Audit, Users, Account** (password, two-factor login, API tokens) and **Search**.
By default, edits are collected as pending changes. Pending rows are shown
inline (green = new, yellow = changed, struck out = deleted) until you