Documentation
¶
Overview ¶
Package app implements the command-line interface. cmd/cipherhorizon/main.go is a thin shim over Main so that everything here is testable in-process, with the clock, serial number, hostname and output streams injected.
Index ¶
Constants ¶
const ( ExitOK = hostcmd.ExitOK // success ExitFatal = hostcmd.ExitFatal // nothing was produced: bad usage, bad config, I/O error, interrupted ExitIncomplete = hostcmd.ExitIncomplete // a CBOM was written, but a sensor failed or a budget was hit )
Exit codes.
const ExitPolicy = 3
ExitPolicy is the exit code when a --fail-on condition is met (PRD-007 REQ-CL-3): the scan ran, and the result is not acceptable. It is distinct from 1 (nothing could be done) and 2 (a result, but an incomplete one), so a CI step can tell the three apart.
const OneLiner = "" /* 183-byte string literal not displayed */
OneLiner says what the product is, the same words everywhere it introduces itself: --help, version, the container image's description, the README (PRD-007 REQ-ST-4).
const ScriptsSumsFile = "inventory-scripts.sha256"
ScriptsSumsFile is the name of the checksum list `scripts export` writes beside the scripts, in the format `sha256sum --check` reads. Releases ship it, covered by the signed checksums.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶
type Env struct {
Stdin io.Reader // "tls cbom --from -" reads it; nil means os.Stdin
Stdout io.Writer // the CBOM goes here unless an output file is configured
Stderr io.Writer // progress, warnings and the PQC summary
Registry *sense.Registry // nil means sense.Default
Now func() time.Time // nil means time.Now
NewSerial func() string // nil means a random UUID
Hostname func() (string, error)
// OS is the host's operating system family, "linux" or "windows"; empty means
// this process's own. Tier reports the privilege of the run ("user" or
// "admin"); nil means the process's real privilege. Both exist so tests are
// deterministic on any machine.
OS string
Tier func() string
// Dial and LookupIP replace the network for "tls scan": how it connects and how it resolves
// a name. nil means the real network. They exist for tests.
Dial func(ctx context.Context, network, addr string) (net.Conn, error)
LookupIP func(ctx context.Context, host string) ([]net.IP, error)
}
Env carries everything Main needs from the outside world.