Skip to content

Serve trusted hardware assignments over mutual TLS - #277

Merged
scotwells merged 2 commits into
mainfrom
t3/investigate-thread-progress
Dec 1, 2026
Merged

scotwells merged 2 commits into
mainfrom
t3/investigate-thread-progress

Conversation

@scotwells

@scotwells scotwells commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Serve hardware samples on a separate mTLS listener; the raw HTTP route remains independent.
  • Trust control-plane-provided static assignments for Device/Project labels and sensor mappings. Remove data-plane inventory authorization reads, ownership expiry, management API credentials, and active-generation markers.
  • Compile revision-matched HTTPS Collector configuration through CompileAssignmentMTLS. The digest prevents mismatched configuration; it is not an ownership lease.
  • Preserve verified BMC TLS/UUID, exact sensor matching, observation timestamps, numeric filtering, missingness, cancellation and concurrency.

Architecture decision

Registration, assignment updates, ownership and removal belong to the control plane. The data plane does not independently enforce ownership freshness. Automatic Device registration/removal reconciliation is not implemented by this PR; the immediate integration uses an operator-provided assignment.

Validation

  • Independent adversarial review found no actionable code or packaging blockers before this renewed human review.
  • Four targeted Fleet packages pass race tests; pinned exporter overlay race tests and binary build pass.
  • Documentation links and whitespace checks pass.
  • Fresh synthetic transport proof passed for this commit: actual Assignment/HTTPS source → stock contrib 0.164.0 → decoded Snappy/protobuf remote write, exact two names/seven labels/original timestamps, zero/negative Celsius/fractional RPM/partial missingness. Missing or wrong-URI client certificates caused no BMC reads. Fresh collection still works after the sample-age interval; the assignment has no expiry. This remains loopback evidence, not live customer delivery.

Rollout gates

No runtime activation is included. The next integration targets a single lab server, with a newly built/pinned image and fresh customer-facing delivery and cross-Project isolation checks. Staging admission accepts the generated Collector configuration, but admission is not transport proof.

Closes #274.

@scotwells
scotwells requested a review from a team as a code owner December 1, 2026 05:36
@scotwells
scotwells requested a review from ecv December 1, 2026 05:36

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes.

The PR description, under "Rollout gates", names one of our real sites and a specific server in this public repo. Replace them with generic wording such as "a single lab server". Nothing in the diff itself needs to change.

The code is sound, and I'd approve it once the body is edited:

  • Qualified samples are served only over mutual TLS. Callers must present a trusted certificate with exactly the configured URI SAN, with TLS 1.2 minimum and no CN fallback.
  • The identity is checked again at request start and before output, so a latched guard or expired chain fails closed on kept-alive connections.
  • The raw HTTP listener has no qualified route, and a config that mismatches qualified targets and listener is refused.
  • CompileQualifiedMTLS forces https with an explicit CA and server name, and verification stays on.
  • go test passes on the changed packages. This closes #274.

@scotwells
scotwells requested a review from ecv December 1, 2026 05:51
@scotwells

Copy link
Copy Markdown
Contributor Author

The requested description edit is complete: Rollout gates now says “a single lab server” and contains no real site or server names. No code change was needed. All 10 checks pass on the unchanged head; ready for re-review.

@scotwells scotwells changed the title Authenticate qualified hardware scraping with mutual TLS Serve trusted hardware assignments over mutual TLS Dec 1, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

PR body now says "a single lab server"; no real site, region or host names in the body or the diff. Prototype scope with no runtime activation, so the dropped ownership checks are a documented trust boundary, not a live exposure. go test ./internal/hardwareotelconfig/... ./internal/hardwarequalification/... passes at 0489249.

  • Delta since 53d5ca7: inventory reads, ownership expiry, management API credentials and the active-generation marker are gone. The exporter now loads one static Assignment file; CompileAssignmentMTLS renders the Collector config from it. The mTLS listener, exact URI SAN, TLS 1.2 minimum, per-request identity recheck, https-only compile with explicit CA and server name, and the raw/qualified listener split are unchanged. Qualified output is still gated by mTLS.
  • Cross-tenant: Project/Device labels are applied by the Collector's relabel rules from the assignment, and labeldrop/labelkeep plus honor_labels: false stop the exporter from injecting its own. A caller or exporter response cannot set the owner; only whoever writes the assignment file and Collector config can. No secrets or real environment names in the added lines (synthetic test values only).
  • Residual risk after a device is reassigned is real but stated in the doc: a stale assignment labels fresh readings with the old owner until the control plane replaces it. Nothing in this PR does that replacement, and nothing fences it (see follow-ups). Acceptable while nothing is activated.

Follow-ups:

  • Assignment provenance is unauthenticated: the file is read from disk, Revision() is an unkeyed hash that only keeps exporter and scraper in agreement, and assignment.go:34 is not an integrity check. Before activation, name who may write the file and how it is delivered (signed, or a mounted secret with restricted writers), and add that to the rollout gates.
  • No reassignment fence and no controller yet: gate any customer-facing activation on the controller that registers, replaces and removes assignments, plus a check that a reassigned device stops emitting under the old Project.
  • The old "observation after qualification time" check was dropped (qualified.go.txt:129), so a sample within max_sample_age_seconds (up to 10 minutes) of a replacement could carry the new owner. Source time is the response decode time, so this is small; consider rejecting samples older than the assignment load time.

@ecv

ecv commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-ups: #285 #286

@scotwells
scotwells merged commit 9ca6820 into main Dec 1, 2026
10 checks passed
@scotwells
scotwells deleted the t3/investigate-thread-progress branch December 1, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authenticate the qualified hardware scrape endpoint

2 participants