agent: enrolment facts are fabricated — one shared literal SSH host key, "skeleton" versions, and a GOOS env bug that hides full-install on Linux #281

Closed
opened 2026-08-05 23:09:54 +00:00 by ben · 1 comment
Owner

agent/cmd/agent/main.go, untagged production build:

  1. Lines ~231 and ~290 (runEnroll, runInstall): SSHHostKey: []byte("skeleton-ssh-host-key") — every fleet node enrolls with the same literal. internal/join/join.go:91 documents the field as "minted at first run", and the real minter (internal/sshkey.Ensure) is already used by the helper. Inert today only because nothing reads PairRequest.SSHHostKey yet — a landmine the moment anything does (host-key pinning is the field's purpose).
  2. Line ~183: OS: os.Getenv("GOOS") — GOOS is a build constant, not an env var, so this is "" on every real machine. enroll.DefaultInstallModes (internal/enroll/ledger.go:746) only offers ModeVM, ModeFull when os == "linux", so Linux hosts joining through the app silently get a VM-only consent menu. Line ~311 of the same file already uses runtime.GOARCH correctly.
  3. Lines ~192, ~236, ~240, ~295: AgentVersion: "skeleton" / Release: "skeleton" on every heartbeat — version drift is invisible; a node stuck on an old agent reads identical to a current one.

Acceptance

  • runtime.GOOS replaces the env read; a Linux host's redeem offers full-install again (test at the DefaultInstallModes boundary).
  • The agent mints/loads a real SSH host key via the existing sshkey.Ensure path instead of the literal.
  • Version/release stamped from the build (ldflags or embedded release file); when genuinely unknown, an honest "unknown", never a uniform literal that parses as a version.

Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code).

`agent/cmd/agent/main.go`, untagged production build: 1. **Lines ~231 and ~290** (`runEnroll`, `runInstall`): `SSHHostKey: []byte("skeleton-ssh-host-key")` — every fleet node enrolls with the same literal. `internal/join/join.go:91` documents the field as "minted at first run", and the real minter (`internal/sshkey.Ensure`) is already used by the helper. Inert today only because nothing reads `PairRequest.SSHHostKey` yet — a landmine the moment anything does (host-key pinning is the field's purpose). 2. **Line ~183**: `OS: os.Getenv("GOOS")` — `GOOS` is a build constant, not an env var, so this is `""` on every real machine. `enroll.DefaultInstallModes` (`internal/enroll/ledger.go:746`) only offers `ModeVM, ModeFull` when `os == "linux"`, so Linux hosts joining through the app silently get a VM-only consent menu. Line ~311 of the same file already uses `runtime.GOARCH` correctly. 3. **Lines ~192, ~236, ~240, ~295**: `AgentVersion: "skeleton"` / `Release: "skeleton"` on every heartbeat — version drift is invisible; a node stuck on an old agent reads identical to a current one. **Acceptance** - `runtime.GOOS` replaces the env read; a Linux host's redeem offers full-install again (test at the DefaultInstallModes boundary). - The agent mints/loads a real SSH host key via the existing `sshkey.Ensure` path instead of the literal. - Version/release stamped from the build (ldflags or embedded release file); when genuinely unknown, an honest "unknown", never a uniform literal that parses as a version. --- _Filed from the 2026-08-05 fail-loud audit (three-agent pre-production sweep; findings verified against code)._
Author
Owner

Fixed in cde5d10 (on origin/main).

Three fabricated enrolment facts in agent/cmd/agent/main.go corrected:

  1. GOOS — os.Getenv("GOOS") (empty at runtime) replaced by hostOS() → runtime.GOOS, mirroring hostArch(). A Linux host now redeems with full-install offered again; asserted at the enroll.DefaultInstallModes boundary (Linux ⇒ ModeFull, "" ⇒ never).
  2. SSH host key — the shared []byte("skeleton-ssh-host-key") literal replaced by a new internal/sshkey.Ensure that mints/loads a real per-machine ed25519 host key (private half persisted 0600, never transmitted; public half returned as the OpenSSH ssh-ed25519 wire blob), mirroring the devicekey idiom. Wired into runEnroll and runInstall.
  3. Version/release — "skeleton" replaced by a link-time-stamped version var (-X main.version=<release>) defaulting to an honest "unknown"; used for AgentVersion (all heartbeats) and the enroll banner Release.

Red-first tests: internal/sshkey/sshkey_test.go (mint/persist/reload stable, per-machine distinct, corrupt file fails loud) and agent/cmd/agent/main_test.go (DefaultInstallModes boundary + version honesty). go test/go vet/golangci-lint green (agent, sshkey, join); the pre-push Go gate passed. STATUS.md updated (header lead + milestone log).

Fixed in cde5d10 (on origin/main). Three fabricated enrolment facts in `agent/cmd/agent/main.go` corrected: 1. **GOOS** — `os.Getenv("GOOS")` (empty at runtime) replaced by `hostOS()` → `runtime.GOOS`, mirroring `hostArch()`. A Linux host now redeems with full-install offered again; asserted at the `enroll.DefaultInstallModes` boundary (Linux ⇒ ModeFull, `""` ⇒ never). 2. **SSH host key** — the shared `[]byte("skeleton-ssh-host-key")` literal replaced by a new `internal/sshkey.Ensure` that mints/loads a real per-machine ed25519 host key (private half persisted 0600, never transmitted; public half returned as the OpenSSH ssh-ed25519 wire blob), mirroring the `devicekey` idiom. Wired into `runEnroll` and `runInstall`. 3. **Version/release** — `"skeleton"` replaced by a link-time-stamped `version` var (`-X main.version=<release>`) defaulting to an honest `"unknown"`; used for `AgentVersion` (all heartbeats) and the enroll banner `Release`. Red-first tests: `internal/sshkey/sshkey_test.go` (mint/persist/reload stable, per-machine distinct, corrupt file fails loud) and `agent/cmd/agent/main_test.go` (DefaultInstallModes boundary + version honesty). `go test`/`go vet`/`golangci-lint` green (agent, sshkey, join); the pre-push Go gate passed. STATUS.md updated (header lead + milestone log).
ben closed this issue 2026-08-06 03:02:34 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#281
No description provided.