feat(hosts): Host-Key und Bootstrap in der Oberflaeche (#009, #010)

Auf der Hostseite: Host-Key abrufen, Fingerprint vergleichen und
vertrauen oder ablehnen. Weicht ein Key vom vertrauten ab, erscheint
eine deutliche Warnung, und Annehmen geht nur mit Haekchen und frischer
Bestaetigung. Danach Bootstrap per Einmal-Passwort oder per Befehl und
Verbindungspruefung, jeweils mit Fortschrittsanzeige.

Der sshd-Befund empfiehlt prohibit-password, wenn root sich per
Passwort anmelden darf - nur als Hinweis, geaendert wird nichts.

E2E im gebauten Stand mit Worker gegen ein echtes sshd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 10:00:43 +02:00
co-authored by Claude Opus 5.5
parent c87c7b4e43
commit 4584669962
12 changed files with 450 additions and 45 deletions
+30 -5
View File
@@ -17,7 +17,10 @@ import { darf } from "@/server/auth/rechte";
import { sitzungErforderlich } from "@/server/auth/sitzungspflicht";
import { hostDetail, type HostDetail } from "@/server/queries/hosts";
import { BootstrapAktionen } from "./BootstrapAktionen";
import { sshdHinweise } from "@/lib/sshd-hinweise";
import { HostKeyAktionen } from "./HostKeyAktionen";
import { HostKeyEntscheidung } from "./HostKeyEntscheidung";
import { bootstrapBefehlFuer } from "@/server/queries/bootstrap";
export const metadata: Metadata = { title: "Host" };
@@ -52,6 +55,7 @@ function SshdBefund({ befund }: { befund: unknown }) {
if (!befund || typeof befund !== "object" || Array.isArray(befund)) return null;
const eintraege = Object.entries(befund as Record<string, unknown>);
if (eintraege.length === 0) return null;
const hinweise = sshdHinweise(befund as Record<string, unknown>);
return (
<div className="border-border mt-5 border-t pt-4">
<p className="text-muted text-[13px] font-medium">sshd-Befund</p>
@@ -63,6 +67,20 @@ function SshdBefund({ befund }: { befund: unknown }) {
</div>
))}
</dl>
{hinweise.length > 0 && (
<ul className="mt-3 flex flex-col gap-1.5 text-[13.5px]">
{hinweise.map((h) => (
<li
key={h.text}
className={
h.stufe === "gefahr" ? "text-danger" : h.stufe === "warnung" ? "text-accent" : "text-muted"
}
>
{h.stufe === "info" ? "ℹ" : "▲"} {h.text}
</li>
))}
</ul>
)}
</div>
);
}
@@ -76,6 +94,7 @@ export default async function HostSeite({ params }: { params: Promise<{ id: stri
const archiviert = host.archiviertAm !== null;
const verwalten = darf(benutzer.rolle, "hostsVerwalten") && !archiviert;
const darfEntscheiden = darf(benutzer.rolle, "hostKeyEntscheiden") && !archiviert;
const jetzt = new Date();
return (
@@ -142,6 +161,7 @@ export default async function HostSeite({ params }: { params: Promise<{ id: stri
darfVerwalten={verwalten}
eingerichtet={host.bootstrapAm !== null}
hostKeyVertraut={host.hostKey.vertraut > 0}
befehl={verwalten && !host.bootstrapAm ? await bootstrapBefehlFuer(host.id) : undefined}
/>
</Karte>
@@ -149,11 +169,7 @@ export default async function HostSeite({ params }: { params: Promise<{ id: stri
titel="Host-Key"
untertitel="Fingerprints, gegen die sshkv jede Verbindung prüft"
aktionen={
<HostKeyAktionen
hostId={host.id}
darfEntscheiden={darf(benutzer.rolle, "hostKeyEntscheiden") && !archiviert}
status={host.hostKey}
/>
<HostKeyAktionen hostId={host.id} darfEntscheiden={darfEntscheiden} status={host.hostKey} />
}
>
{host.hostSchluessel.length === 0 ? (
@@ -184,6 +200,15 @@ export default async function HostSeite({ params }: { params: Promise<{ id: stri
<span className="hidden md:block">
<HostSchluesselStatusBadge status={k.status} />
</span>
{k.status === "AUSSTEHEND" && darfEntscheiden && (
<HostKeyEntscheidung
hostId={host.id}
hostSchluesselId={k.id}
ersetztVertrauten={host.hostSchluessel.some(
(v) => v.status === "VERTRAUT" && v.algorithmus === k.algorithmus,
)}
/>
)}
</li>
))}
</ul>