From a61dfd854fead8a76b8a9c308f3a8cd25795f7cb Mon Sep 17 00:00:00 2001 From: mnovak Date: Sat, 7 Nov 2026 23:48:44 +0100 Subject: [PATCH] [web] Decisions applied: openssl signing by hand with the .ext file, Sign out link, renew soon 30 days before a device certificate ends --- apps/web/src/App.svelte | 1 + apps/web/src/lib/types.ts | 3 ++- apps/web/src/views/Certificates.svelte | 2 +- apps/web/src/views/RenewByHand.svelte | 33 +++++++++++++++++++------- apps/web/src/views/Settings.svelte | 1 + 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/apps/web/src/App.svelte b/apps/web/src/App.svelte index 5507c99..674e7a6 100644 --- a/apps/web/src/App.svelte +++ b/apps/web/src/App.svelte @@ -96,6 +96,7 @@

{viewer?.via === "authelia" ? `Signed in as ${viewer.name} through Authelia` : viewer ? `Using the API token "${viewer.name}"` : "Signed in through Authelia"}

Control on 127.0.0.1 only

+ {#if app.overview?.site?.auth_logout_url}Sign out{/if}
IANITOR DOMI
diff --git a/apps/web/src/lib/types.ts b/apps/web/src/lib/types.ts index 407bd31..3f093d9 100644 --- a/apps/web/src/lib/types.ts +++ b/apps/web/src/lib/types.ts @@ -117,6 +117,7 @@ export interface PkiRequest { message_code: string; message: string; approve_command: string | null; + file_base?: string | null; problem: string | null; } @@ -156,7 +157,7 @@ export interface Overview { active_apply: { id: string; state: string; summary: string; seconds_left: number | null; queued: number } | null; repo: { name: string; last_push_at: string | null; unpushed: number; push_error_code: string | null } | null; intermediate: IntermediateView | null; - site: { forward_auth_configured: boolean; acme_configured: boolean; secrets: string[]; watch_seconds: number; share_links_available: boolean } | null; + site: { forward_auth_configured: boolean; acme_configured: boolean; secrets: string[]; watch_seconds: number; share_links_available: boolean; auth_logout_url?: string | null } | null; paused: Blocked | null; paused_reason: string | null; health_error: Blocked | null; diff --git a/apps/web/src/views/Certificates.svelte b/apps/web/src/views/Certificates.svelte index f0b7a4e..c17f226 100644 --- a/apps/web/src/views/Certificates.svelte +++ b/apps/web/src/views/Certificates.svelte @@ -151,7 +151,7 @@ {d.name} until {shortDate(d.not_after)} - {#if d.state === "revoked"}{:else if d.state === "expired"}{/if} + {#if d.state === "revoked"}{:else if d.state === "expired"}{:else if Date.parse(d.not_after) - app.now < 30 * 86_400_000}{/if} {#if confirmRevoke === d.id} Revoke the certificate of "{d.name}"? It can no longer get in. diff --git a/apps/web/src/views/RenewByHand.svelte b/apps/web/src/views/RenewByHand.svelte index 6278c16..8372488 100644 --- a/apps/web/src/views/RenewByHand.svelte +++ b/apps/web/src/views/RenewByHand.svelte @@ -15,20 +15,34 @@ let err = $state(null); let pending = $state(false); let starting = $state(false); - const day = new Date().toISOString().slice(0, 10); + const base = $derived(r?.file_base ?? `domi-intermediate-${new Date().toISOString().slice(0, 10)}`); - function download() { - if (!r?.csr_pem) return; - const url = URL.createObjectURL(new Blob([r.csr_pem], { type: "application/pkcs10" })); + function save(text: string, name: string, type: string) { + const url = URL.createObjectURL(new Blob([text], { type })); const a = document.createElement("a"); a.href = url; - a.download = `domi-intermediate-${day}.csr`; + a.download = name; document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(url), 1000); } + function download() { + if (r?.csr_pem) save(r.csr_pem, `${base}.csr`, "application/pkcs10"); + } + + async function downloadExt() { + if (!r) return; + try { + const res = await fetch(`/api/v1/pki-requests/${encodeURIComponent(r.request_id)}/ext`, { headers: { "X-Ianitor-UI": "1" }, redirect: "manual", credentials: "same-origin" }); + if (res.ok) save(await res.text(), `${base}.ext`, "text/plain"); + else err = "The signing settings file could not be downloaded. Reload the page and try again."; + } catch { + err = "Ianitor's control service is not answering."; + } + } + async function file(e: Event) { const f = (e.currentTarget as HTMLInputElement).files?.[0]; if (f) pem = await f.text(); @@ -75,14 +89,14 @@

Download the request

This file asks the Domi root to sign a new intermediate certificate. It holds no secret.

Check that the offline computer shows the same code: {r.match_code}

-
+

Step 2

Sign it on the offline computer

-

Copy the file to the offline computer that holds the Domi root, then run:

-
ianitor-control ca sign --root <root folder> --csr domi-intermediate-{day}.csr --out domi-intermediate-{day}.crt
-

It asks for the root's passphrase and shows the code; sign only if it is the code above.

+

Copy both files to the offline computer that holds the Domi root, then run:

+
{r.approve_command ?? `openssl x509 -req -in ${base}.csr -CA domi-root.crt -CAkey domi-root.key -days 365 -sha256 -extfile ${base}.ext -out ${base}.crt`}
+

Before signing, check that the request is the one this page shows: openssl req -in {base}.csr -noout -subject. (On a computer with Ianitor installed, ianitor-control ca sign does the same and shows the match code.)

Step 3

@@ -105,6 +119,7 @@ {/if} diff --git a/apps/web/src/views/Settings.svelte b/apps/web/src/views/Settings.svelte index bda12ba..43acad5 100644 --- a/apps/web/src/views/Settings.svelte +++ b/apps/web/src/views/Settings.svelte @@ -169,6 +169,7 @@

{settings?.watch_seconds ?? app.overview?.site?.watch_seconds ?? 60} seconds

Signed in

{viewer ? (viewer.via === "authelia" ? `${viewer.name} through Authelia` : `API token "${viewer.name}"`) : "Through Authelia"}

+ {#if app.overview?.site?.auth_logout_url}

Sign out

{/if} {:else if tab === "api"}

API tokens