Native console MFA
Last updated: 2026-11-27T14:16:11-03:00 (UTC-3)
Native MFA adds a second factor after the console’s first factor: an authenticator-app code (TOTP, RFC 6238), a passkey (WebAuthn), or a one-time recovery code. It protects console identity only; inference API keys, model requests and provider authentication are unchanged. For proof of MFA performed by an identity provider, see federated MFA; both can apply to the same sign-in.
Once an identity has a confirmed factor, every sign-in for it needs that factor: the shared admin or viewer token, a named user’s personal token, OIDC (legacy and named providers) and SAML. A successful first factor opens only a restricted pending flow; the normal session cookie is issued when the second factor succeeds. The MFA response never grants a role, permission or team: the session has exactly the identity’s existing authority.
Enable it
Section titled “Enable it”All four switches default to false. The method switches have no effect without local_mfa.
| Flag | What it enables |
|---|---|
local_mfa |
Native MFA state, policy and the pending sign-in |
local_totp |
Authenticator-app enrollment and verification (needs the provider encryption key) |
local_webauthn |
Passkeys for an already identified user (needs admin.local_mfa.webauthn trust) |
local_mfa_recovery |
One-time recovery codes |
features: local_mfa: true local_totp: true local_webauthn: true local_mfa_recovery: truestorage: provider_encryption_key_env: GATEWAY_PROVIDER_ENCRYPTION_KEY # factor secrets are encrypted with itadmin: local_mfa: required_roles: [admin] webauthn: rp_id: gateway.example.com origins: [https://gateway.example.com]Turning a switch off never makes an enrolled or required identity sign in with one factor: its sign-in is refused (403 native_mfa_unavailable) until a usable method is back or an administrator resets it. Turn local_mfa off only after removing requirements and factors you no longer want.
Authenticator secrets and passkey credentials are encrypted with the provider encryption keyring (labels native-mfa:v1:<kind>:<principal>:<id>) and are included in gateway reencrypt. Losing that key makes stored factors unreadable; affected users then need a reset.
Policy fields
Section titled “Policy fields”admin.local_mfa is the YAML base. Settings → Console MFA and PUT /api/v1/admin/security/local-mfa store a complete override (current global version and expected_base_fingerprint required); DELETE returns to YAML. The WebAuthn block is boot trust: it is read only from YAML, never from a request’s Host or forwarded headers, and changing it needs a restart.
| Field | Default | Bounds and meaning |
|---|---|---|
admin.local_mfa.required_roles |
[] |
Built-in roles that must use MFA: admin, viewer, operator, user, team_viewer, team_admin, org_admin (an organization admin, with organization_admins). A custom role uses its base role |
admin.local_mfa.protect_bootstrap |
false |
Require MFA for the shared admin token. It also blocks that token’s Bearer path |
admin.local_mfa.protect_shared_viewer |
false |
Same for the shared viewer token |
admin.local_mfa.challenge_ttl |
5m |
30s–15m; pending sign-in, TOTP enrollment and passkey prompt lifetime |
admin.local_mfa.fresh_proof_ttl |
5m |
30s–15m; lifetime of the one-use proof for a sensitive change |
admin.local_mfa.enrollment_ticket_ttl |
1h |
5m–72h; administrator reset ticket lifetime |
admin.local_mfa.max_attempts |
5 |
1–10 failed proofs per identity, across methods and replicas |
admin.local_mfa.attempt_window |
5m |
30s–1h; window that counts failures |
admin.local_mfa.lockout_duration |
5m |
30s–1h; even a right code is refused during the lockout (429 mfa_locked, Retry-After) |
admin.local_mfa.max_pending_per_principal |
3 |
1–10; oldest pending sign-ins (and session prompts) beyond it are dropped |
admin.local_mfa.max_pending_total |
10000 |
100–100000; beyond it new sign-ins get 503 mfa_capacity |
admin.local_mfa.max_passkeys |
10 |
1–20 per identity |
admin.local_mfa.recovery_code_count |
10 |
5–20 codes per batch |
admin.local_mfa.totp.issuer |
m7gtw |
1–80 bytes, no control characters or : |
admin.local_mfa.totp.algorithm |
SHA1 |
SHA1, SHA256, SHA512 |
admin.local_mfa.totp.digits |
6 |
6 or 8 |
admin.local_mfa.totp.period_seconds |
30 |
15–120 |
admin.local_mfa.totp.skew_steps |
1 |
0–2 adjacent timesteps accepted for clock drift |
admin.local_mfa.webauthn.rp_id |
"" |
Lowercase DNS name or localhost; empty admits no passkey ceremony |
admin.local_mfa.webauthn.origins |
[] |
1–8 exact https://host[:port] origins of rp_id or its subdomains; http://localhost:<port> only with admin.allow_insecure_http |
admin.local_mfa.webauthn.display_name |
m7gtw |
1–80 bytes shown by the browser |
The TOTP algorithm, digits and period are stored with each factor: changing them affects new enrollments only. Most authenticator apps support only the defaults. Passkeys need a DNS name (not an IP address) as the relying party.
When a policy write makes a role or shared token required, the time is recorded in PostgreSQL. Sessions issued before it are refused from then on and do not come back if the requirement is later removed. A write that would require MFA for the saving administrator without a usable method is refused with 422.
Sign in
Section titled “Sign in”- The first factor answers
202instead of a session:An HttpOnly, SameSite=Strict{"authenticated": false, "stage": "verify", "purpose": "login","methods": ["totp", "webauthn", "recovery"], "enroll_methods": ["totp", "webauthn"],"expires_at": "2026-11-14T16:05:00Z", "challenge_csrf_token": "<value>", "principal_kind": "user"}gateway_mfa_pendingcookie binds the flow to this browser. OIDC and SAML callbacks redirect to/ui/#login=mfa(or/ui/#login=mfa_unavailablewhen the identity cannot use any method).GET /api/v1/admin/sessionreturns the same202view, so a reload resumes the flow. - Pending calls send
X-MFA-Challenge: <challenge_csrf_token>:verifystage:POST /api/v1/admin/mfa/verify {"method":"totp","code":"123456"},{"method":"recovery","code":"mfar_..."}, or the passkey pairPOST /mfa/webauthn/authenticate/optionsthen/finish {"credential": {...}}.enrollstage (a required identity without a factor):POST /mfa/totp/beginthen/mfa/totp/confirm {"factor_id","code"}, or/mfa/webauthn/register/optionsthen/finish {"name","credential"}. The first factor also returns the initial recovery codes once.ticketstage (after an administrator reset):POST /mfa/enrollment-ticket {"ticket":"mfae_..."}, then enroll.POST /mfa/cancelretires the pending flow only.
- Success answers
{"authenticated": true, "csrf_token": "...", "mfa_method": "totp"}and sets the normal session cookie;/sessionthen reportsmfa_method.
A pending flow can only add the identity’s first factor; once a factor exists, other pending flows of the same identity must verify it.
Each TOTP timestep is accepted once per identity across all replicas, and each recovery code once. Every attempt, right or wrong, is counted before it is checked, so parallel guesses cannot exceed max_attempts.
Manage your factors
Section titled “Manage your factors”Account security (every console role, from a browser session) shows your factors, how this session was verified and the recovery codes left (GET /api/v1/admin/mfa). Enrolling the first factor needs no extra step; the session is reissued under the protected identity and other sessions opened with the first factor alone end.
Removing a factor, replacing the recovery codes or adding another factor need a fresh proof: POST /mfa/challenge {"purpose":"manage"}, then a verify or passkey proof with the session’s X-CSRF-Token. That proof grants one credit for fresh_proof_ttl; it never performs the change. Then DELETE /mfa/totp, DELETE /mfa/passkeys/{id} or POST /mfa/recovery-codes. Removing a factor ends every session verified before it; removing your last factor signs you out. A required identity cannot remove its last factor (409 mfa_required).
Reset by an administrator
Section titled “Reset by an administrator”A global administrator (native_mfa:manage) sees a user’s status on Console users → MFA (GET /api/v1/admin/users/{id}/mfa, counts only) and can reset it with the user’s current version (POST /api/v1/admin/users/{id}/mfa/reset). The reset deletes the user’s factors and recovery codes, ends its sessions and returns a one-time mfae_ ticket valid for enrollment_ticket_ttl. The user signs in with the first factor, presents the ticket (accepted for one pending sign-in) and must enroll a new factor; a reset never leaves the account with one factor. Administrators cannot reset their own factors; they use Account security. Hand the ticket over privately; it is not stored in clear or logged. Resets are audited as native_mfa.reset.
The shared admin and viewer tokens have no administrator above them. If their factors and recovery codes are lost, an operator with the configuration and database runs:
gateway native-mfa-reset --principal shared:admin --applyIt prints the ticket once as JSON (--principal also accepts shared:viewer or a usr_ ID). The ticket lifetime is the YAML enrollment_ticket_ttl. There is no HTTP bypass.
Upgrade and operations
Section titled “Upgrade and operations”Migrations 140 and 141 add the factor, recovery, pending-flow and requirement tables and the policy override. Every session read now consults the identity’s MFA state in PostgreSQL, including shared-token sessions and the shared-token Bearer path; when that state cannot be read, the request answers 503 authentication_state_unavailable instead of being admitted. Older binaries ignore native factors, so upgrade every replica before enrolling anyone.
Logs carry native_mfa_verified, native_mfa_failed (with a finite reason), native_mfa_locked, native_mfa_enrolled, native_mfa_removed and native_mfa_reset with the request ID; codes, secrets, tickets, challenges and WebAuthn parser errors are never logged. Identity audit rows record enrollment, removal, recovery use and regeneration, and resets.
Admin API routes
Section titled “Admin API routes”Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.
| Route | What it does |
|---|---|
GET /api/v1/admin/security/local-mfa |
The YAML base, console override and effective MFA policy, with defaults and bounds |
DELETE /api/v1/admin/security/local-mfa |
Removes the console override of the MFA policy |
POST /api/v1/admin/mfa/challenge |
Opens a proof flow for a signed-in session; a verified factor then earns one credit for removing a factor, replacing recovery codes or adding another |
POST /api/v1/admin/mfa/cancel |
Abandons a pending sign-in flow and clears its cookie; no session is revoked |
POST /api/v1/admin/mfa/enrollment-ticket |
Redeems the one-time mfae_ ticket an administrator issued after resetting the identity, so it can enroll again |
POST /api/v1/admin/mfa/totp/begin |
Creates a pending authenticator app and returns its secret, URI and QR code once |
POST /api/v1/admin/mfa/totp/confirm |
Activates the pending app with a code; the first factor also returns the recovery codes once |
DELETE /api/v1/admin/mfa/totp |
Removes the authenticator app with a fresh proof, ending every session proven before |
POST /api/v1/admin/mfa/webauthn/register/options |
Starts registering a passkey for the identity |
POST /api/v1/admin/mfa/webauthn/register/finish |
Verifies and stores the new passkey |
POST /api/v1/admin/mfa/webauthn/authenticate/options |
Starts a passkey proof for the identity already identified by its first factor |
POST /api/v1/admin/mfa/webauthn/authenticate/finish |
Verifies the passkey proof: completes the sign-in or earns a fresh-proof credit |
DELETE /api/v1/admin/mfa/passkeys/{id} |
Removes one passkey with a fresh proof |
POST /api/v1/admin/mfa/recovery-codes |
Replaces the recovery codes with a fresh proof and returns the new batch once |