Message Attestation: example with out-of-process policy server#600
Draft
liustanley wants to merge 15 commits into
Draft
Message Attestation: example with out-of-process policy server#600liustanley wants to merge 15 commits into
liustanley wants to merge 15 commits into
Conversation
Implements the Message Attestation feature from opamp-spec PR open-telemetry#333. Every ServerToAgent is wrapped in a SignedServerToAgent envelope carrying a detached X.509 signature. Agents that opt in can verify that responses originate from an authorised distribution server and have not been tampered with in transit. The feature is fully opt-in and backward-compatible: agents and servers that do not configure attestation continue to use the existing wire format unchanged. New signing/ package — pluggable interfaces (Signer, Verifier, TrustAnchorProvider, TOFUStore) with in-process and remote-delegation implementations. RemoteSigner supports out-of-process policy servers as recommended in supplementary-guidelines.md. Server: Settings.PayloadSigner enables signing. The server auto-advertises OffersPayloadTrustVerification and wraps outbound messages after capability negotiation with the agent. Client: StartSettings.PayloadVerifier / PayloadTOFUStore enable verification. Chain validation (RFC 5280), SAN check, and per-message signature verification are enforced by attestationState. TOFU enrollment bootstraps the verifier from the first TrustChainResponse and persists it via TOFUStore.
Demonstrates the recommended production deployment pattern from supplementary-guidelines.md: the OpAMP distribution server holds no private key material. Signing is delegated to a separate policy server that can inspect the payload, enforce organisational policies, and delegate to an HSM before returning a signature. policysrv: standalone HTTP signing service exposing /v1/sign, /v1/chain, /v1/ca. Run it alongside the example server to see the full attestation flow end-to-end. Example server: --policy-server flag wires a RemoteSigner so the OpAMP server signs every outbound ServerToAgent through the policy server. Example agent: --attestation-ca configures a pre-provisioned trust anchor; --attestation-tofu-store enables TOFU enrollment for environments where out-of-band CA provisioning is impractical.
…r empty string hostname
…ttestation enabled
This was referenced Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Extends the
internal/examples/agent and server to demonstrate Message Attestation end-to-end, following the isolated out-of-process signing architecture.Depends on: #599
What's included
internal/examples/policysrv/— new standalone HTTP signing service (the "policy server")internal/examples/server/—--policy-serverflag wires aRemoteSignerintoSettings.PayloadSignerinternal/examples/agent/—--attestation-caand--attestation-tofu-storeflagsArchitecture
The OpAMP server holds no private key material. Every outbound
ServerToAgentis forwarded to the policy server for signing. The policy server can inspect the payload, enforce organisational policies, and delegate to an HSM before returning a signature.Running the example
The examples live in their own Go module, so run all commands from the
internal/examplesdirectory (each in its own terminal):cd internal/examples1. Start the policy server
The policy server generates a fresh ephemeral CA on every start and writes it to
/tmp/opamp-policy-ca.pem— the agent loads this as its payload trust anchor.2. Start the OpAMP server
go run ./server/ \ --policy-server http://localhost:4322 # Server signs every outbound ServerToAgent via the policy server3. Start the agent
Option A — pre-provisioned CA (recommended for production):
go run ./agent/ \ --attestation-ca /tmp/opamp-policy-ca.pemOption B — TOFU enrollment (first connection accepts and pins the CA):
go run ./agent/ \ --attestation-tofu-store /tmp/my-trust-anchor.pem # On first run: enrolls and saves the CA to the file. # On subsequent runs: uses the saved CA as a pre-configured trust anchor.--attestation-caand--attestation-tofu-storeare mutually exclusive.What to observe
Message Attestation enabledon startup.--rotate-interval 30s, orcurl -X POST http://localhost:4322/v1/rotate. The root CA (trust anchor) is unchanged, so the agent re-validates the new chain and keeps verifying without reconnecting. (The example server uses a short chain-cache TTL so rotations are picked up promptly.)Key files
internal/examples/policysrv/main.go/v1/sign,/v1/chain,/v1/ca,/v1/rotate(+--rotate-interval)internal/examples/server/main.go--policy-serverflaginternal/examples/server/opampsrv/opampsrv.gosigning.NewRemoteSignerintoSettings.PayloadSignerinternal/examples/agent/main.go--attestation-ca/--attestation-tofu-storeflagsinternal/examples/agent/agent/agent.goPayloadVerifier/PayloadTOFUStoreintoStartSettings