Repository navigation
feat(first-run): a first-run wizard behind a gate that asks the bootstrap state first - #151
Merged
Merged
Conversation
…trap state first Before sign-in the web UI now asks GetBootstrapState. Closed, not applicable, or a manager without first run: the normal sign-in. Open: it tries WhoAmI, and a browser that already holds an admin certificate goes straight in; otherwise the first-run wizard opens. Unavailable: it says why, then shows the sign-in. The wizard: - Token: the server certificate fingerprint check first, where to find the token on Linux, macOS and Windows, and the already-started notice. The session secret lives only in memory and goes only in the Fleetos-Bootstrap-Session header. - Operator CA: the shared registration form (CRL source, OCSP mode, fingerprint confirm), or re-confirming a CA a previous session registered. - First admin, path A: name and email, a P-384 key with the key backup downloaded before the CSR is shown, the CSR with the admin section and signing command, then the signed certificate is recorded and the PKCS#12 built with the backup's passphrase and the CA as the chain. It can also continue from an existing key backup. - First admin, path B: the OpenSSL recipe and an optional pre-flight. - Install: steps for each OS and a reload. Mock mode keeps first run closed unless VITE_BOOTSTRAP_MOCK_STATE=open. The stubs are refreshed to api main for the new 1610 FULL_NAME sub-reason, which the first admin submission can return; it has its own message. Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Contributor
Author
|
Merging for the v0.1.0 test run: CI green and mergeable at merge time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
A new Fleet Manager with no operator CA configured starts in first run, and the web UI still sent everyone to the certificate sign-in, which nobody could pass yet. This adds the first-run wizard and a gate that asks the manager's bootstrap state before anything else.
Closes #144
BootstrapGate): wraps the auth gate and callsGetBootstrapStatefirst. Closed, not applicable, or a manager without first run: the normal sign-in. Open or open-in-progress: it tries WhoAmI, and a browser that already presents an admin certificate goes straight in (which closes first run); otherwise the wizard opens. Unavailable: a note naming the reason (DATABASE_REQUIRED,FIRST_RUN_DISABLED), then the sign-in.src/lib/bootstrap.ts): the session secret fromStartBootstrapSessionis kept in module memory only and sent only in theFleetos-Bootstrap-Sessionheader; never a cookie, web storage or a URL.server certificate SHA-256log line), then where to find the token on Linux, macOS and Windows (PowerShell), a "Before you start" panel (an external operator CA; a CryptOS node can't be one), and the already-started notice for open-in-progress.NO_CRLacknowledgement, OCSP mode, fingerprint confirm), submitting toBootstrapService. In a session that finds a CA already registered, it shows that CA for re-confirmation by pasted fingerprint, or lets the operator register a different one.FleetOS admin (<email>)friendly name. "I already have a key backup" resumes after a session expiry.openssl ca,openssl pkcs12 -export) and an optional pre-flight that sends only the certificate.VITE_BOOTSTRAP_MOCK_STATE=openopens it (and makes mock sign-in act like a browser with no certificate) to try the wizard offline. The dev server proxiesBootstrapService.main(41f7be4) for the new 1610FULL_NAMEsub-reason, which first-admin submission can return; it has its own message. The refresh also carriesRemoveNode, unused here.Existing test changed:
App.test.tsx"keeps the console behind the login gate" now waits for the Log in button, because the gate asks the bootstrap state before showing it. The error-copy test lists the newFULL_NAMEsub-reason.Checked against the manager: CryptOS-PKI/cryptos-manager#160 (merged): the header name and CORS allow-header,
x-cryptos-error-reason, an emptycsr_dermeaning no CSR, and the empty-ca_cert_derpreview and re-confirm (an empty answer when nothing is registered) all match.Docs: companion CryptOS-PKI/docs#84 (a web wizard page in the first-run section). README and AGENTS.md are updated here.
Verification
How this was verified
src/lib/bootstrap.test.ts: the state call is anonymous, the session secret goes only in the header (never in a body or URL) and nothing lands in localStorage, sessionStorage or cookies, the CSR is sent only when there is one.src/components/layout/bootstrap-gate.test.tsx: each state branches correctly, including open and open-in-progress with a successful and a failed WhoAmI, unavailable with its reason, and a manager without first run.src/components/first-run/first-run-wizard.test.tsx: the token step's fingerprint note and per-OS commands, a refused token by code, path A end to end (fingerprint confirm, no CSR before the backup download, the PKCS#12 sealed with the backup's passphrase and the CA as the chain), path B, and a live-mode run asserting that no request body carries the PKCS#8 key, the JWKdor the passphrase, and nothing is stored.npm run lint,npm test(91 files, 552 tests),npm run buildandtask licensepass locally.