sign ssh certificates on demand from ssh itself, warn before setup, say what to do when a host key changes
This commit is contained in:
parent
fc29fc89c0
commit
3d7541c0af
2 changed files with 521 additions and 67 deletions
|
|
@ -19,6 +19,7 @@ import { Hint } from "../../ui/hint/Hint.js";
|
|||
import { Preformatted } from "../../ui/preformatted/Preformatted.js";
|
||||
import type { GrantState } from "./AgentPermissions.js";
|
||||
import {
|
||||
forgetHostKeyCommand,
|
||||
sshBody,
|
||||
sshSummary,
|
||||
targetSnippet,
|
||||
|
|
@ -77,19 +78,27 @@ export function AgentSsh({ agent, g }: { agent: string; g: GrantState }) {
|
|||
title={`whether ${agent} may get SSH certificates from the swarm`}
|
||||
popoverLabel={`${agent} SSH access`}
|
||||
>
|
||||
<p class="ui-badge-popover-help" role="note">
|
||||
<strong>Warning:</strong> SSH access with no constraints on the
|
||||
machine makes {agent} unconstrained there. Whatever {agent}'s own
|
||||
sandbox stops it doing, it can do on a machine it can log in to. Only
|
||||
allow this for machines you would let {agent} control completely.
|
||||
</p>
|
||||
<p class="ui-badge-popover-help">
|
||||
Lets {agent} log in over SSH to machines that trust the swarm's SSH
|
||||
certificate authority. With this on, {agent} gets a certificate that
|
||||
names it and lasts one hour, and renews it every 20 minutes; its key
|
||||
lives in memory only. The change reaches {agent} within about 25
|
||||
minutes. A certificate already signed stays valid until it expires, at
|
||||
most three hours. A machine has to trust the authority before anything
|
||||
works: see "on the target" below.
|
||||
certificate authority. With this on, {agent} signs its own key for a
|
||||
certificate that names it, on its first <code>ssh</code> after the
|
||||
swarm has updated its login, which takes seconds. The certificate
|
||||
lasts one hour, and the key lives in memory only. Switching off stops
|
||||
new certificates within seconds; one already signed stays valid until
|
||||
it expires, an hour after signing. A machine has to trust the
|
||||
authority before anything works: see "on the target" below.
|
||||
</p>
|
||||
<p class="ui-badge-popover-help" role="note">
|
||||
{agent} accepts the key a machine shows on the first connection and
|
||||
refuses a changed one afterwards (trust on first use). It does not
|
||||
check the key against anything you registered.
|
||||
refuses a changed one afterwards (trust on first use). If a host's key
|
||||
really changed, check the new key out of band, then forget the old one
|
||||
with <code>{forgetHostKeyCommand(agent)}</code> on the hive host.
|
||||
</p>
|
||||
<CheckboxField
|
||||
id={`ssh-${agent}`}
|
||||
|
|
|
|||
|
|
@ -73,3 +73,12 @@ export function targetSnippet(
|
|||
return `# in ~<user>/.ssh/authorized_keys on the target\n${authorizedKeysLine(agent, ca)}`;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The command that makes the agent forget a host's recorded key, run as root on
|
||||
* the hive host after the operator has checked the new key out of band. The
|
||||
* agent's pins live in its state directory.
|
||||
*/
|
||||
export function forgetHostKeyCommand(agent: string): string {
|
||||
return `ssh-keygen -R <host> -f /agents/${agent}/state/ssh_known_hosts`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue