Incident runbook¶
What to do when the vault key, the database, or an admin session may have been copied.
Nexus stores every pilot's EVE SSO refresh token. Any one of the database, VAULT_MASTER_KEYS,
or a live admin session is enough to read mail, wallets, and locations until the grants are
revoked at CCP.
This is the emergency control for leaked ESI tokens. It does not replace rotating VAULT_MASTER_KEYS or the
database passwords after the copy is contained.
What the kill switch does¶
Admin → Emergency, or POST /api/v1/admin/emergency. The caller needs
admin.emergency.revoke. A superadmin has that without a grant. The request must be
same-origin, and the body must contain the confirmation phrase exactly:
{ "confirm": "REVOKE ALL ESI GRANTS", "maintenance": true }
maintenance means "leave maintenance on after CCP finishes". A revoke of every pilot
turns maintenance on either way, for the whole CCP loop, so a new sign-in cannot mint a
token the wipe already missed. Unchecked, it is turned off when the loop finishes.
In order:
- Every stored refresh token is decrypted into memory. Nothing is sent to CCP yet.
- One database transaction turns maintenance on (for a revoke of every pilot), replaces each ciphertext with a single zero byte, deletes the sessions, revokes OIDC access and refresh tokens, and writes the summary audit row. The wipe runs again as the last statement, so a sign-in that committed while the transaction was open is wiped too. If that audit insert fails, it is logged and the kill still commits: sessions must not stay alive because the audit table rejected a row.
- The handler returns 202. The page shows the job (
total,done,failed). - A background task sends each in-memory token to CCP
(
EVE_REVOKE_URL, defaulthttps://login.eveonline.com/v2/oauth/revoke), spaced and retried, and writes oneemergency.character_revokedaudit row per character. Revoking any refresh token ends that character's whole grant for this EVE application.
A failed CCP revoke cannot be retried. The ciphertext is already gone, so Nexus no longer
has the refresh token to send. Reset or rotate the EVE application secret at
https://developers.eveonline.com. Do that anyway during a real incident: it ends grants
this action could not revoke, including access tokens already issued (those keep working
for about 20 minutes otherwise). If the process restarts while the job is running, the
job is marked interrupted and the remaining calls are not resumed, for the same reason.
If a Discord webhook is configured for background-check alerts, one message is posted when the local kill commits. Mentions are off. A missing webhook does not fail the action.
Access tokens CCP has already issued keep working until they expire, about 20 minutes. The revoke does not shorten those.
One pilot¶
POST /api/v1/admin/users/<account id>/revoke-esi with { "confirm": "REVOKE ESI GRANTS" }.
The same permission and same-origin check. Other pilots are left alone.
Banning a pilot decrypts first, commits the ban together with the wipe, the session
delete, and the OIDC revoke, then tells CCP from memory. Do that before deleting an
account. DELETE FROM accounts destroys the ciphertext, and CCP cannot be told after that.
Maintenance mode¶
PUT /api/v1/admin/emergency/maintenance with { "enabled": true, "confirm": "ENABLE MAINTENANCE" }
or DISABLE MAINTENANCE. While it is on, pilots get 503 on the API. The callback stays
reachable so someone can sign in and turn it off, but only a superadmin or a holder of
admin.emergency.revoke may finish that sign-in. Anyone else is refused, and Nexus stores
no token and no session for them.
The flag is stored in system_config (maintenance). It is still on after a restart until
someone disables it.
When CCP revoke fails¶
The job's failed count is the characters CCP did not accept. Those grants may still work
at CCP. They cannot be retried from Nexus: the local copy was wiped before the call, on
purpose, so a dropped request cannot leave the tokens in the database.
Reset or rotate the EVE application secret at https://developers.eveonline.com. Do this
even when every row succeeded, during a real incident. Update EVE_CLIENT_ID and
EVE_CLIENT_SECRET, and set the callback to PUBLIC_URL/sso/callback. Pilots sign in
again, which creates new grants. Until an admin has saved a scope list, that sign-in asks
only for publicData.
While maintenance is on, only a superadmin or someone with admin.emergency.revoke can
finish signing in. Everyone else's callback is refused and stores no token and no session.
If EVE_CLIENT_ID is empty, the mass revoke refuses to wipe anything, so the tokens can be
revoked once the client id is set.
After the revoke¶
- Treat
VAULT_MASTER_KEYSas compromised. Generate a new key, put it in front of the old one (2:<hex>,1:<old hex>) so existing ciphertext that was not wiped can still be opened, then remove the old key only after every remaining secret has been re-sealed. Wiped ESI tokens do not need the old key. - Rotate
POSTGRES_PASSWORD,POSTGRES_APP_PASSWORD, and the Discord bot token. Nexus does not store the Cloudflare API token or the connector token. Rotate the API token at Cloudflare if it may have been copied, and replaceCLOUDFLARE_TUNNEL_TOKEN. - Confirm the audit log contains
emergency.revokeand oneemergency.character_revokedper character. - Tell pilots to sign in again. Tell them the previous EVE grant was revoked.
- Turn maintenance off when sign-in works.
Tunnel connector¶
cloudflared is its own container. It has CLOUDFLARE_TUNNEL_TOKEN and no vault key. A
fault in the connector cannot read VAULT_MASTER_KEYS or DATABASE_URL. Restart it with
docker compose restart cloudflared. The public hostname's service is http://nexus:8080.
Upgrading an install that still has the old <project>_nexus network on
172.31.250.0/24 fails docker compose up with Pool overlaps with other one on this
address space. The edge network uses that subnet. Run docker compose down, then
docker network rm <project>_nexus (eve-nexus_nexus with the project name in the
compose file), then docker compose up -d.