Skip to content

Sign each Connector with the agent's endpoint key - #268

Merged
ecv merged 2 commits into
mainfrom
connector-key-binding
Nov 28, 2026
Merged

ecv merged 2 commits into
mainfrom
connector-key-binding

Conversation

@ecv

@ecv ecv commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

The control plane can now refuse to route to a Connector whose endpoint ID it can't tie to the agent that published it, and this change gives agents the proof. The agent signs each Connector's UID and endpoint ID with its endpoint key and writes the signature to Connector status. The operator side runs in production in count-only mode (datum-cloud/network-services-operator#990, released in v0.44.0), so routing stays as it is today.

What changes for users

Nothing visible. After updating, an agent's Connectors start reporting as verified. One agent can still serve Connectors in several projects, because it signs each one separately.

Older control planes

A control plane older than v0.44.0 drops the new field. The agent notices on read-back and retries with a growing interval, up to once an hour, so it never loops.

Testing

  • cargo test --workspace passes (71 tests), on current main.
  • A shared test vector checks the agent signs the same bytes the operator verifies.
  • Unit tests cover a missing binding, a stale Connector UID, a dropped binding and a matching one.

ecv added 2 commits November 27, 2026 15:05
The agent now signs each Connector it publishes with its iroh endpoint key, so
the control plane can check that the endpoint id in the Connector status is
held by the agent that wrote it.

Key changes:
- Add optional publicKey.binding.signature to the Connector connection
  details, omitted when unset
- Sign "datum-connector-binding/v1\n<connector uid>\n<endpoint id>" with the
  endpoint's ed25519 secret key, base64 std encoded
- Heartbeat and tunnel setup write the binding, and re-patch connection
  details when the binding is missing or differs from the expected one
- Unit tests for the message format, verification, a wrong UID, and a fixed
  test vector
The heartbeat only re-sent connection details when they changed locally, so a
binding the API server dropped, or one signed for a Connector UID that has
since changed, stayed wrong until the agent restarted.

Key changes:
- Heartbeat reads the Connector back every 5 minutes, refreshes its UID and
  re-signs when the UID changes, and re-patches when the status lacks the
  binding it sent
- While the binding keeps being dropped, the read-back interval doubles up
  to 1 hour, so an older control plane never causes a patch loop
- A lease renew 404 forces a fresh Connector read and UID refresh
- Warn once when a Connector has no UID instead of silently sending details
  without a binding
- Tunnel setup remembers the binding it last sent per Connector UID and skips
  the patch while the read-back is unchanged since that send
- Re-patch decisions are pure functions with unit tests for a missing
  binding, a stale UID, a dropped binding and a matching one
@ecv
ecv requested a review from a team as a code owner November 27, 2026 20:07
@ecv
ecv requested a review from scotwells November 27, 2026 20:07
@ecv
ecv enabled auto-merge November 27, 2026 20:07
@ecv
ecv requested a review from kevwilliams November 28, 2026 02:27

@kevwilliams kevwilliams 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.

The signature covers a versioned label plus Connector UID and endpoint ID, signed by that endpoint's own key, so it cannot replay onto another Connector.

@ecv
ecv merged commit 32f3237 into main Nov 28, 2026
11 checks passed
@ecv
ecv deleted the connector-key-binding branch November 28, 2026 14:44
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.

3 participants