physical.parseSshfunctionno test imports itfunction parseSsh(text: string): Result<{ readonly user: string; readonly address: string; readonly port?: number | undefined; }, string>user@host[:port] read, or why not.
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 } }physical.parseSshfunctionno test imports itfunction 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 ittype EnrollTarget = { readonly user: string; readonly address: string; readonly port?: number };The machine and the account to enroll it under.
physical.EnrollOptionstypeno test imports ittype 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 ittype 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 itfunction enrollProbe(ssh: EnrollTarget, o: EnrollOptions): Promise<Result<Enrolled, string>>Enrolls a machine (see the module).
physical.probeExecutorfunctionno test imports itfunction 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.
parseSshfunctionfunction parseSsh(text: string): Result<{ readonly user: string; readonly address: string; readonly port?: number | undefined; }, string>user@host[:port] read, or why not.
EnrollTargettypeno test imports ittype EnrollTarget = { readonly user: string; readonly address: string; readonly port?: number };The machine and the account to enroll it under.
EnrollOptionstypeno test imports ittype 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 ittype 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.
enrollProbefunctionfunction enrollProbe(ssh: EnrollTarget, o: EnrollOptions): Promise<Result<Enrolled, string>>Enrolls a machine (see the module).
probeExecutorfunctionfunction 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.