[web] Decisions applied: openssl signing by hand with the .ext file, Sign out link, renew soon 30 days before a device certificate ends
This commit is contained in:
@@ -151,7 +151,7 @@
|
||||
<Icon name={kindIcon(d.kind)} />
|
||||
<span class="dname">{d.name}</span>
|
||||
<span class="ia-muted">until {shortDate(d.not_after)}</span>
|
||||
{#if d.state === "revoked"}<Status kind="unknown" word="revoked {d.revoked_at ? shortDate(d.revoked_at) : ''}" />{:else if d.state === "expired"}<Status kind="down" word="expired" />{/if}
|
||||
{#if d.state === "revoked"}<Status kind="unknown" word="revoked {d.revoked_at ? shortDate(d.revoked_at) : ''}" />{:else if d.state === "expired"}<Status kind="down" word="expired" />{:else if Date.parse(d.not_after) - app.now < 30 * 86_400_000}<Status kind="degraded" word="renew soon" />{/if}
|
||||
{#if confirmRevoke === d.id}
|
||||
<span class="confirm">Revoke the certificate of "{d.name}"? It can no longer get in.
|
||||
<Button small onclick={() => (confirmRevoke = null)} data-autofocus>Cancel</Button>
|
||||
|
||||
@@ -15,20 +15,34 @@
|
||||
let err = $state<string | null>(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 @@
|
||||
<h2 class="ia-h3">Download the request</h2>
|
||||
<p class="ia-text2">This file asks the Domi root to sign a new intermediate certificate. It holds no secret.</p>
|
||||
<p>Check that the offline computer shows the same code: <span class="ia-code small" aria-label="Match code {r.match_code}">{r.match_code}</span></p>
|
||||
<div><Button icon="copy" onclick={download}>Download the request (.csr)</Button></div>
|
||||
<div class="row"><Button icon="copy" onclick={download}>Download the request (.csr)</Button><Button icon="copy" onclick={downloadExt}>Download the signing settings (.ext)</Button></div>
|
||||
</section>
|
||||
<section class="step">
|
||||
<p class="ia-label">Step 2</p>
|
||||
<h2 class="ia-h3">Sign it on the offline computer</h2>
|
||||
<p class="ia-text2">Copy the file to the offline computer that holds the Domi root, then run:</p>
|
||||
<pre class="ia-secret ia-cmd">ianitor-control ca sign --root <root folder> --csr domi-intermediate-{day}.csr --out domi-intermediate-{day}.crt</pre>
|
||||
<p class="ia-muted">It asks for the root's passphrase and shows the code; sign only if it is the code above.</p>
|
||||
<p class="ia-text2">Copy both files to the offline computer that holds the Domi root, then run:</p>
|
||||
<pre class="ia-secret ia-cmd">{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`}</pre>
|
||||
<p class="ia-muted">Before signing, check that the request is the one this page shows: <code>openssl req -in {base}.csr -noout -subject</code>. (On a computer with Ianitor installed, <code>ianitor-control ca sign</code> does the same and shows the match code.)</p>
|
||||
</section>
|
||||
<section class="step">
|
||||
<p class="ia-label">Step 3</p>
|
||||
@@ -105,6 +119,7 @@
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.row { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.step { border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
|
||||
.small { font-size: 1.4rem; }
|
||||
</style>
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
<p>{settings?.watch_seconds ?? app.overview?.site?.watch_seconds ?? 60} seconds</p>
|
||||
<p class="ia-label">Signed in</p>
|
||||
<p>{viewer ? (viewer.via === "authelia" ? `${viewer.name} through Authelia` : `API token "${viewer.name}"`) : "Through Authelia"}</p>
|
||||
{#if app.overview?.site?.auth_logout_url}<p><a class="domi-btn link" href={app.overview.site.auth_logout_url}>Sign out</a></p>{/if}
|
||||
{:else if tab === "api"}
|
||||
<div class="row">
|
||||
<h2 class="ia-h3">API tokens</h2>
|
||||
|
||||
Reference in New Issue
Block a user