IF Commons GitHub

physical/enroll

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0007-machine-probe-enroll FR-001, 0007-machine-probe-enroll FR-002, 0007-machine-probe-enroll FR-003

Enrolling a machine for observation: the host keys it presents are shown by their fingerprints and nothing is done until the person gives the one they compared with the machine's own; then that host key, and only it, is pinned in a known-hosts file, a key is made for the probe (kept outside any repository), and, over the person's own ssh, the probe and one line that restricts the key to it are installed in the person's own account. It changes nothing on the machine but those two. What is to be written where a program keeps its files (the reach, the observation) is the caller's: this gives the data. The probe is then asked with the restricted key by probeExecutor and observe.

import { parseSsh } from "./enroll.ts";
parseSsh("admin@sparta.example:2222"); // { kind: "ok", value: { user: "admin", address: "sparta.example", port: 2222 } }

Source: commons/machine-probe/src/physical/enroll.ts

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

physical.parseSshfunctionno test imports it
function parseSsh(text: string): Result<{ readonly user: string; readonly address: string; readonly port?: number | undefined; }, string>

user@host[:port] read, or why not.

physical.EnrollTargettypeno test imports it
type EnrollTarget = { readonly user: string; readonly address: string; readonly port?: number };

The machine and the account to enroll it under.

physical.EnrollOptionstypeno test imports it
type EnrollOptions = { readonly asset: string; readonly knownHosts: string; readonly keys: string; readonly identity?: string; readonly fingerprint?: string };

What enrolling is given beyond the machine: a name for it, the file that pins host keys, the folder of the probe's keys, the key the person reaches the machine with (the agent or the default key where none) and the fingerprint they compared (none until they have).

physical.Enrolledtypeno test imports it
type Enrolled =
  | { readonly kind: "show"; readonly fingerprint: string; readonly address: string }
  | { readonly kind: "done"; readonly reach: ProbeReach; readonly keyFile: string; readonly line: string; readonly pinned: readonly string[] };

What enrolling came to: the fingerprints to compare and nothing done, or done, with the reach to keep, the file of the probe's private key and the line that was installed.

physical.enrollProbefunctionno test imports it
function enrollProbe(ssh: EnrollTarget, o: EnrollOptions): Promise<Result<Enrolled, string>>

Enrolls a machine (see the module).

physical.probeExecutorfunctionno test imports it
function probeExecutor(reach: ProbeReach, knownHosts: string, keyFile: string): Result<Executor, string>

The way to run the probe of an enrolled machine: the ssh client with the restricted key and the pinned host keys, and nothing the person's own key can do.

parseSshfunction
function parseSsh(text: string): Result<{ readonly user: string; readonly address: string; readonly port?: number | undefined; }, string>

user@host[:port] read, or why not.

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

EnrollTargettypeno test imports it
type EnrollTarget = { readonly user: string; readonly address: string; readonly port?: number };

The machine and the account to enroll it under.

EnrollOptionstypeno test imports it
type EnrollOptions = { readonly asset: string; readonly knownHosts: string; readonly keys: string; readonly identity?: string; readonly fingerprint?: string };

What enrolling is given beyond the machine: a name for it, the file that pins host keys, the folder of the probe's keys, the key the person reaches the machine with (the agent or the default key where none) and the fingerprint they compared (none until they have).

Enrolledtypeno test imports it
type Enrolled =
  | { readonly kind: "show"; readonly fingerprint: string; readonly address: string }
  | { readonly kind: "done"; readonly reach: ProbeReach; readonly keyFile: string; readonly line: string; readonly pinned: readonly string[] };

What enrolling came to: the fingerprints to compare and nothing done, or done, with the reach to keep, the file of the probe's private key and the line that was installed.

enrollProbefunction
function enrollProbe(ssh: EnrollTarget, o: EnrollOptions): Promise<Result<Enrolled, string>>

Enrolls a machine (see the module).

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

probeExecutorfunction
function probeExecutor(reach: ProbeReach, knownHosts: string, keyFile: string): Result<Executor, string>

The way to run the probe of an enrolled machine: the ssh client with the restricted key and the pinned host keys, and nothing the person's own key can do.

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

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