Admin MFA and the local install account¶
Status: part 1 built (December 2026): passkeys, security keys and an authenticator app on EVE
accounts, step-up on the list below, and the admin_mfa_required switch (crates/core-api/src/mfa.rs,
migration 0031). Part 2, the local install account with its password, recovery codes and
core-api admin init, is not built yet. A security review found that admin and superadmin
actions rested on a single EVE login; this is the fix.
Part 1 differs from the text below in small ways:
- The two tunnel endpoints that only print a docker compose command (restart, enable) have no
step-up, because they change nothing.
- Adding a factor to an account that already has one, or removing one, needs a fresh step-up:
a passkey once the account has a passkey, otherwise either kind. So an authenticator code can't
add or remove a passkey. The first factor needs an EVE sign-in from the last 10 minutes
instead, so a copied session can't enroll the thief's factor. Enrolling never counts as a
step-up proof, and removing a factor clears every proof the account's sessions hold.
- Failed codes and assertions are counted per account in mfa_failures (five in 15 minutes),
under a per-account lock so parallel guesses can't get past the count. Anyone holding the
session can use this to lock the owner out of step-up for 15 minutes. The per-IP count is
deferred: EVE accounts are always signed in, so it arrives with the local account.
- While admin_mfa_required is on, anyone without the right factor is refused step-up actions
(superadmin or not), a superadmin can't remove their last factor, and the switch can only be
turned on by a superadmin who has a passkey.
- Recovery for an EVE account that lost every factor is core-api mfa-reset <main character name>
on the server. It removes that account's factors and writes mfa.reset to the audit log. There
are no EVE recovery codes.
- A key whose sign count goes backwards is refused and logged with its credential id; it is not
disabled automatically.
EVE SSO remains how pilots sign in. This document adds two things beside it:
- A second factor, and a fresh second factor, for dangerous admin actions.
- An optional account that is not an EVE character, created at install, for when EVE SSO is down or the EVE superadmin character is gone.
The local account is off unless an operator creates it. It can be disabled later. While it exists, it cannot be used without MFA.
What this account is¶
It is not a row in accounts with is_superadmin set. An EVE sign-in must never attach to it, and it must never receive an ESI token.
Store it in its own table, local_admins:
| Column | Purpose |
|---|---|
id |
Stable id, used as the audit actor |
username |
Chosen at install. Not admin |
password_hash |
Argon2id PHC string |
enabled |
Operator switch. Disabled refuses every login and step-up |
created_at, disabled_at |
|
failed_attempts, locked_until |
Throttle state |
A separate local_admin_credentials table holds WebAuthn credentials. A separate local_admin_totp row holds the sealed TOTP secret. Recovery codes are individual rows, hashed, single use.
Audit rows need an actor that is not an accounts id. Add actor_kind (eve or local) and actor_local_id, and keep actor_account_id null for local actions. Do not overload actor_account_id with a synthetic EVE account.
The local account's power is the same set of actions as a superadmin, because that is the break-glass case: the EVE superadmin cannot sign in, and someone still has to revoke tokens or fix the tunnel. It does not bypass the audit log, and it does not skip step-up.
Password¶
Use Argon2id. The argon2 crate is already a dependency and its Argon2::default() is Argon2id with the OWASP memory and time parameters (19 MiB, time cost 2, parallelism 1). Call those parameters by name in the installer so a future crate default cannot silently weaken them. Salt is 16 random bytes, stored inside the PHC string. The password itself is held in a Zeroizing buffer and is never logged, never put in an audit row, and never returned by any API.
Minimum length 15 characters. Reject a password equal to the username. The installer prompts twice on a terminal and does not echo. There is no default password in the image, the compose file, or .env.example.
Verification of an unknown username runs Argon2 against a dummy hash, the same pattern OIDC already uses for an unknown client, so the response time does not reveal whether the username exists.
MFA is mandatory¶
The installer does not enable the account until both of these are true:
- A password has been set.
- At least one WebAuthn credential or TOTP has been enrolled, and a challenge against it has succeeded in the same install session.
After that, every login is password plus that factor. A password alone never creates a session. Disabling the last factor is refused while the account is enabled. Disabling the account is how an operator turns the whole feature off.
Prefer WebAuthn. TOTP is allowed because not every operator has a hardware key on the day they install. The actions in the step-up list below that move secrets (tunnel, signing key, kill switch, superadmin grant) require a WebAuthn assertion, not a TOTP code. TOTP is enough for ordinary login and for the lower step-up actions.
WebAuthn¶
One WebAuthn registration flow covers hardware security keys, platform authenticators, and synced passkeys. Do not add a separate U2F path.
- Relying party id is the host of
PUBLIC_URL. Relying party origin isPUBLIC_URL's origin. Refuse to enroll, and refuse to enable the local account, whenPUBLIC_URLis nothttps. Loopbackhttpis allowed only whenPUBLIC_URLis loopback, for a development install, and the install command prints that this is not a production setting. - Challenge is 32 random bytes, stored server-side, single use, five minutes.
- User verification required (
uv). User presence required. - Attestation is not required. Requiring attestation blocks keys that operators actually have.
- Store credential id, COSE public key, sign count, AAGUID, transports, and the backup flags.
- A credential that is not backup-eligible must present a sign count greater than the stored count. A backup-eligible credential may present a zero count. A count that moves backwards on a non-backup credential deletes no data and refuses the assertion. Write an audit row either way.
- An account may hold several credentials. Removing one still leaves the rule "at least one factor" intact.
- Ceremony requests are same-origin POSTs, like the rest of the admin API.
TOTP¶
- 20 random bytes, sealed with the token vault. Associated data
local_admin_totp:{id}. The plaintext is shown once, as a secret and as anotpauthURI, and is not stored outside the vault. - SHA-1, 6 digits, 30 second step, window of one step either side. Accept a code once. Store the last accepted step so the same code cannot be replayed inside the window.
- Enrollment is finished only after a correct code.
- Rate limit TOTP attempts with the same lockout as the password.
Recovery codes¶
Ten codes, generated in the installer and again whenever an operator asks for a new set. Show them once. Store only an Argon2id hash of each code, or a SHA-256 of a high-entropy code (128 bits is enough for SHA-256). Using a code:
- Consumes it.
- Writes
local_admin.recovery_used. - Creates a session that can sign in, and that session cannot perform a step-up action until a new WebAuthn credential or a new TOTP secret has been enrolled.
Recovery codes are the break-glass for a lost key, not a second everyday factor. There is no password-only bypass and no "email the code" path.
Sessions¶
A different cookie from nexus_session, name __Host-nexus_admin, path /, HttpOnly, Secure, SameSite=Strict. __Host- means the cookie is rejected unless it is Secure and the path is /, which matches the https requirement above.
- Absolute lifetime 8 hours.
- Idle timeout 15 minutes, updated on use.
- Login creates a new row and does not reuse an old one.
- Disabling the account deletes its session rows.
- The cookie is not accepted on
/sso,/oauth/token, or/oauth/userinfo. Those stay EVE and OIDC flows.
The session record stores authenticated_at and mfa_at. Step-up updates mfa_at.
Step-up¶
Dangerous actions check mfa_at and require it within the last five minutes, and require the method recorded on that step-up.
WebAuthn required:
- Grant or remove superadmin.
- Tunnel create, token replace, restart, disable, delete.
- OIDC signing-key rotation and client-secret rotation.
- The mass ESI revoke.
- Disable or re-enable the local account. Re-enable also requires a fresh enrollment check.
WebAuthn or TOTP accepted:
- Blacklist and lift.
- Reporter webhook and alliance-sheet URL.
- Deleting an OIDC client.
- Changing org scope categories.
The check is server-side. The UI prompts, but a missing or stale mfa_at is a 401 with a machine-readable step_up_required, not a silent success.
EVE superadmins use the same step-up list. They enroll a WebAuthn credential on their EVE account (same credential table shape, account_id instead of local_admin_id). Roll this out in two steps so a deploy does not lock every admin out:
- Enrollment is offered. Dangerous actions succeed and the UI nags.
- A setting
admin_mfa_required, off by default, makes the step-up list refuse an EVE superadmin who has no credential. Turn it on after the operators have enrolled. The local account does not get this grace period.
Lockout¶
Five failed passwords, TOTP codes, or WebAuthn assertions for one username inside 15 minutes, or 20 failures from one client IP inside 15 minutes, sets locked_until 15 minutes ahead. The response is the same generic failure as a bad password. Lockout expires on its own. It does not permanently disable the only admin. An audit row local_admin.locked is written on the transition into lockout, not on every failure. Failures are still counted.
The limit is in the database, not only in the process-local throttle, so a restart does not clear it.
Disable¶
enabled = false is the supported off switch. A disabled account cannot log in, cannot step up, and has no sessions. The row, the credentials, and the audit history stay. Re-enable is an install-level command or a step-up action by an EVE superadmin, and it requires a successful MFA challenge before enabled is set back to true. Deleting the row is not required and is not offered in the UI.
If the local account is disabled and every EVE superadmin is locked out, recovery is the schema owner in the database, setting enabled back and writing an audit row by hand. Document that next to the current superadmin SQL, and treat it as the last resort. Do not ship a well-known recovery password.
Install¶
A command, core-api admin init, run once, on a terminal:
- Refuse if
PUBLIC_URLis not https, except for the loopback development case noted above. - Ask for a username and a password.
- Start WebAuthn registration or TOTP enrollment.
- Require a successful challenge.
- Print recovery codes.
- Insert the row with
enabled = trueand writelocal_admin.created.
Running it a second time while an enabled account exists refuses, and tells the operator to disable the existing one first. The command does not read the password from an environment variable. Environment variables end up in process listings and in compose config.
Audit¶
Write these, and do not write secrets, passwords, TOTP seeds, recovery codes, or WebAuthn challenges:
local_admin.created,local_admin.disabled,local_admin.enabledlocal_admin.loginandlocal_admin.login_failed(failure rows can be sampled the way OIDC already samples unauthenticated misses, plus the lockout row)local_admin.mfa_enrolled,local_admin.mfa_removedlocal_admin.step_upwith the action name that followslocal_admin.recovery_used
The actor kind is local. The same step-up events for an EVE superadmin use actor kind eve and the existing account id.
What not to build¶
- A shared
admin/admindefault. - MFA that is only checked in the React app.
- Storing the TOTP seed or the WebAuthn private key. The private key stays on the authenticator. Nexus stores the public key.
- SMS or email codes.
- A long-lived API token for the local account. It uses the session cookie above.
- Putting the local account through the OIDC provider. It is not a pilot, and it has no character claims.