Documentation
¶
Overview ¶
Package machinefacts turns the plain-text facts file written by the inventory scripts (cipherhorizon-inventory.ps1 and cipherhorizon-inventory.sh) into a CycloneDX CBOM.
The scripts only gather facts a person can read before uploading: the host's name, operating system and privilege, the crypto-relevant packages installed, and public certificates. The judgement (what a package can do, what a certificate's algorithms mean) is made here, by the same sensors, knowledge base and CBOM builder the Go collector uses, so a script inventory and a collector inventory say the same thing about the same machine.
The format is one fact per line, fields separated by tabs:
cipherhorizon-machine-facts 3 script <name> <version> host name|os|os-version|privilege|collected <value> os-release <base64 of /etc/os-release> package-manager dpkg|rpm|apk package dpkg|rpm|apk <name> <version> <arch> cert-file <absolute path> <base64 of the file> store-cert LocalMachine|CurrentUser <store> yes|no|unknown <base64 DER> note <text>
Version 2 added signature-driven records ("fact <signature> <kind> …": registry, file, program, line) with "signatures", "ran" and "skip" lines; version 3 (PRD-019) adds the kinds "query" (a fixed engine query's output line) and "listener" (a listening socket with its process and the cryptographic libraries it loaded).
Everything in the file came from the machine and is treated as untrusted: sizes are bounded, and nothing that looks like private key material is kept.
Index ¶
Constants ¶
const Header = "cipherhorizon-machine-facts"
Header is the first line of every facts file.
const (
MaxBytes = 32 << 20
)
Limits on one facts file.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Facts ¶
type Facts struct {
Script, ScriptVersion string
Name, OS, OSVersion string
Privilege string // user | admin
Collected string
OSRelease []byte
Managers []string // the package managers the script asked, even when they listed nothing
Packages []Package
CertFiles []CertFile
StoreCerts []StoreCert
Notes []string
// Dropped counts entries refused while parsing (private key material, bad encoding, limits).
Dropped int
// Version 2 (signature-driven engines): what each signature returned beyond packages and
// certificates, how many facts each produced, and the ones that could not run.
Items []Item
Ran map[string]int
Skipped map[string]string
SignatureDB string
}
Facts is a parsed facts file.
type Item ¶
type Item struct {
Sig string // the signature id
Kind string // registry | file | program | line
Fields []string // registry: key, name, value; file: path, size, sha256, version, product; program: name, version, publisher; line: path, text; query: id, text; listener: proto, address, port, pid, process, executable, libraries
}
Item is one registry value, file, installed program or configuration line a signature returned.
type Package ¶
type Package struct {
Manager, Name, Version, Arch string
}
Package is one installed package.
type Script ¶
type Script struct {
Name string `json:"name"`
Platform string `json:"platform"`
Run string `json:"run"` // the command that runs it
SHA256 string `json:"sha256"` // of the bytes served
Size int `json:"size"`
Signatures int `json:"signatures"` // how many signatures it carries
DBVersion string `json:"signatureDb"`
// contains filtered or unexported fields
}
Script is one inventory script as the server hands it out: the engine from this repository with the current signature database for its platform written in between its markers, so what a person reads is what runs.