Build the on-host agent that pairs with fleet-hostapi and feeds the fleet-manager control plane (TODO #14 "STILL TO BUILD (a)"). Nothing on the workstation talked to the manager before this; Monitor + InfluxDB stayed empty. Scope: telemetry only. The agent reuses the host TPM identity for mTLS (read-only tpmkey.LoadSigner at 0x81000100 + cert from NV 0x01800100; the private key never leaves the TPM), opens the long-lived FleetAgent.Session bidi stream, sends Hello + periodic HealthSnapshot (load/cpu/temp/mem/tmpfs/nvme/auth/selinux/chrony/kiosk, probed read-only from /proc+/sys plus hostapi facts), and LOGS but does not act on the DesiredState/Command it receives. Reconcile actuators (kiosk URL, reboot, drain) are deferred until the telemetry half is bench-verified. - files/agent/: new module (go-tpm + grpc), static CGO_ENABLED=0 like enrol/hostapi. Copies the enrol tpmkey (+ read-only LoadSigner) and the generated fleet.agent.v1 proto so it stays self-contained without importing the initramfs enrol module. - files/agent/simtest/: proves the TPM-signed cert completes a real mTLS client-auth handshake (RequireAndVerifyClientCert) against the go-tpm software simulator. - files/etc/fleet-agent/agent.env: fleet-generic config (manager DNS name, fleet CA reused from radius-ca.pem, TPM handle/nvindex, interval). No per-host state. - fleet-agent.service: hardened unit (tss group for /dev/tpmrm0, INET egress). - CI builds fleet-agent out-of-VM + runs vet/test + the simulator handshake test. - Packer: enable_agent flag (default on) + 2b-agent provisioner + fapolicyd trust. Post-switch-root only, so no dracut/initramfs changes. - docs: TODO #14 + fleet-management-design as-built updated. Requires the host already enrolled (broker approve births the inventory row) — else the manager returns PermissionDenied, the correct "not enrolled yet" signal.
29 lines
1.2 KiB
AMPL
29 lines
1.2 KiB
AMPL
// fleet-agent — the on-host steady-state control-plane client (telemetry v1).
|
|
//
|
|
// Runs in the BOOTED system (post switch-root), NOT the initramfs. It reuses the
|
|
// host's TPM identity (signing key at 0x81000100 + cert in NV 0x01800100) as an
|
|
// mTLS client cert, opens the long-lived FleetAgent.Session bidi stream to the
|
|
// fleet-manager, sends Hello + periodic HealthSnapshot, and (v1) logs but does not
|
|
// act on the desired-state/commands it receives. See docs/fleet-management-design.md.
|
|
//
|
|
// Unlike fleet-hostapi (stdlib-only) this needs gRPC + go-tpm; like fleet-enrol it
|
|
// is a static CGO_ENABLED=0 binary whose deps are proxy-fetched, go.sum-PINNED, and
|
|
// built out-of-VM in CI (never enters the reproducible image build's toolchain).
|
|
// Dep versions track serving/fleet-manager/go.mod (the peer of this wire contract).
|
|
module fleet-agent
|
|
|
|
go 1.26
|
|
|
|
require (
|
|
github.com/google/go-tpm v0.9.8
|
|
google.golang.org/grpc v1.82.0
|
|
google.golang.org/protobuf v1.36.11
|
|
)
|
|
|
|
require (
|
|
golang.org/x/net v0.53.0 // indirect
|
|
golang.org/x/sys v0.43.0 // indirect
|
|
golang.org/x/text v0.36.0 // indirect
|
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260414002931-afd174a4e478 // indirect
|
|
)
|