Skip to content

Commit

Permalink
fix(website): fix authorized SSH key states shown on host details
Browse files Browse the repository at this point in the history
  • Loading branch information
vst committed Apr 15, 2024
1 parent 3b856b3 commit 91da467
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions website/src/components/report/ShowHostDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,11 @@ export function TabulateSshKeys({ host, data }: { host: HostReport; data: HostPa
return (
<Table aria-label="Table of SSH Keys" removeWrapper color="secondary" showSelectionCheckboxes={false}>
<TableHeader>
<TableColumn key="problem">Problem?</TableColumn>
<TableColumn key="type">Type</TableColumn>
<TableColumn key="length">Length</TableColumn>
<TableColumn key="known">Known?</TableColumn>
<TableColumn key="seen">Seen?</TableColumn>
<TableColumn key="fingerprint">Fingerprint</TableColumn>
<TableColumn key="seen-comments">Comments</TableColumn>
</TableHeader>
Expand All @@ -247,15 +249,21 @@ export function TabulateSshKeys({ host, data }: { host: HostReport; data: HostPa
const keyS = keysSeen[fp];
const key = (keyG || keyH || keyS) as SshPublicKey;
const known: 'global' | 'host' | 'unknown' = keyG ? 'global' : keyH ? 'host' : 'unknown';
const seen = keyS ? true : false;
const problem = (known === 'unknown' && seen) || ((known === 'host' || known === 'global') && !seen);
const comments = Array.from(new Set(keys.filter((x) => x.fingerprint === fp).map((x) => x.comment)));

return (
<TableRow key={fp}>
<TableCell>{problem ? '🔴' : '🟢'}</TableCell>
<TableCell>{key.type}</TableCell>
<TableCell>{key.length}</TableCell>
<TableCell>
<Chip color={known === 'global' ? 'success' : known === 'host' ? 'primary' : 'danger'}>{known}</Chip>
</TableCell>
<TableCell>
<Chip color={seen ? 'success' : 'danger'}>{seen ? 'yes' : 'no'}</Chip>
</TableCell>
<TableCell>
{key.fingerprint}
<div>
Expand Down

0 comments on commit 91da467

Please sign in to comment.