IF Commons GitHub

physical/boot-server

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0004-netboot-physical FR-005, 0004-netboot-physical FR-006

The boot server: the answers to what a machine asks over TFTP and HTTP, from the pinned files, the menus, the arming kept in a file and what the fleet gives for each host (its install data, its MAC and the secret that is put in as the file is served). A host that is not armed boots its own disk. An install's files are served only under the token it was armed with; the password hash is put in as the file is served and is never kept in a rendered file; the guard's decision is the server's; and the installer's done disarms the host, so that its next network boot does not reinstall it.

import { startBoot } from "./boot-server.ts";
// const s = await startBoot({ stateFile, assets, pins, provider, http: { port: 0 }, tftp: { port: 0 } }); await s.stop();

Source: commons/netboot/src/physical/boot-server.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.BootProvidertypeno test imports it
type BootProvider = { /** The hosts that can be installed, with their MAC addresses where the fleet knows them. */ h… (617 characters)
type BootProvider = {
  /** The hosts that can be installed, with their MAC addresses where the fleet knows them. */
  hosts(): Promise<ReadonlyArray<{ readonly name: string; readonly mac?: string }>>;
  /** The install's `user-data` for a host, as rendered (with the placeholders). */
  userData(host: string): Promise<string | undefined>;
  /** The install's `meta-data` for a host. */
  metaData(host: string): Promise<string | undefined>;
  /** The hash of the administrator's password, kept on the boot machine and never in the fleet's repository. */
  passwordHash(host: string): Promise<string | undefined>;
};

What the fleet gives the server for its hosts.

physical.BootEventtypeno test imports it
type BootEvent = { readonly at: string; readonly kind: "http" | "tftp" | "install"; readonly detail: string };

What the server is told of as it goes.

physical.BootOptionstypeno test imports it
type BootOptions = { readonly stateFile: string; readonly assets: Assets; /** The profile of the distribution this… (642 characters)
type BootOptions = {
  readonly stateFile: string;
  readonly assets: Assets;
  /** The profile of the distribution this server serves: its files, its menu entries and its install document. */
  readonly profile: BootProfile;
  readonly provider: BootProvider;
  readonly http: { readonly port: number; readonly hostname?: string };
  readonly tftp: { readonly port: number; readonly hostname?: string };
  /** The server's own URL as a machine reaches it, ending in a slash; the address the request was made to where it is not given. */
  readonly baseUrl?: string;
  readonly now?: () => string;
  readonly emit?: (e: BootEvent) => void;
};

What the server is given.

physical.BootServertypeno test imports it
type BootServer = { readonly httpPort: number; readonly tftpPort: number; stop(): Promise<void> };

A running boot server.

physical.bootHandlerfunctionno test imports it
function bootHandler(o: BootOptions): (r: BootRequest) => Promise<BootResponse>

The handler of both transports: the file or text a path names, and the install's posts.

physical.startBootfunctionno test imports it
function startBoot(o: BootOptions): Promise<BootServer>

Starts the HTTP and TFTP servers over one handler.

BootProvidertype
type BootProvider = { /** The hosts that can be installed, with their MAC addresses where the fleet knows them. */ h… (617 characters)
type BootProvider = {
  /** The hosts that can be installed, with their MAC addresses where the fleet knows them. */
  hosts(): Promise<ReadonlyArray<{ readonly name: string; readonly mac?: string }>>;
  /** The install's `user-data` for a host, as rendered (with the placeholders). */
  userData(host: string): Promise<string | undefined>;
  /** The install's `meta-data` for a host. */
  metaData(host: string): Promise<string | undefined>;
  /** The hash of the administrator's password, kept on the boot machine and never in the fleet's repository. */
  passwordHash(host: string): Promise<string | undefined>;
};

What the fleet gives the server for its hosts.

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

BootEventtypeno test imports it
type BootEvent = { readonly at: string; readonly kind: "http" | "tftp" | "install"; readonly detail: string };

What the server is told of as it goes.

BootOptionstypeno test imports it
type BootOptions = { readonly stateFile: string; readonly assets: Assets; /** The profile of the distribution this… (642 characters)
type BootOptions = {
  readonly stateFile: string;
  readonly assets: Assets;
  /** The profile of the distribution this server serves: its files, its menu entries and its install document. */
  readonly profile: BootProfile;
  readonly provider: BootProvider;
  readonly http: { readonly port: number; readonly hostname?: string };
  readonly tftp: { readonly port: number; readonly hostname?: string };
  /** The server's own URL as a machine reaches it, ending in a slash; the address the request was made to where it is not given. */
  readonly baseUrl?: string;
  readonly now?: () => string;
  readonly emit?: (e: BootEvent) => void;
};

What the server is given.

BootServertypeno test imports it
type BootServer = { readonly httpPort: number; readonly tftpPort: number; stop(): Promise<void> };

A running boot server.

bootHandlerfunction
function bootHandler(o: BootOptions): (r: BootRequest) => Promise<BootResponse>

The handler of both transports: the file or text a path names, and the install's posts.

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

startBootfunction
function startBoot(o: BootOptions): Promise<BootServer>

Starts the HTTP and TFTP servers over one handler.

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

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