IF Commons GitHub

targets/ssh/trust

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0007-ssh-coverage FR-002

The verb of first contact (commons headless 0007-ssh-coverage FR-002): trust-host <target> [--fingerprint SHA256:...]. Without a fingerprint it only shows what the host presents and says how to confirm it; with one, which a person checked by another way, it records the host in the repository's known hosts if the host showed that fingerprint, and records nothing otherwise. The fingerprint is an option only a person may give, the action comes through the local channel only, and it is confirmed by a person: so no flag, tool server or script can accept a key on anyone's behalf. This replaces StrictHostKeyChecking=accept-new, which this library never writes.

import { trustHostCommand } from "./trust.ts";
// const verb = trustHostCommand({ targets, run: (argv, opts) => proc.output(argv, opts), append: (line) => appendToKnownHosts(line) });

Source: commons/headless/src/targets/ssh/trust.ts

1 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

TrustDepstypeno test imports it
type TrustDeps = {
  readonly targets: readonly Target[];
  readonly run: RunLocal;
  /** Appends one line to the repository's known hosts. */
  readonly append: (line: string) => Promise<void> | void;
  /** The verb's own name, for the words it tells a person to run; `trust-host` by default. */
  readonly name?: string;
};

What the verb needs of its program: the targets, how a local program is run, and where a line of known hosts is written.

trustHostCommandfunction
function trustHostCommand(deps: TrustDeps): Command

The verb that shows what a host presents and, given the fingerprint a person checked, records the host.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.