Skip to content

feat(agent): derive QUIC endpoint from enrollment URL host#1795

Closed
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 2 commits into
feat/agent-tunnel-identity-pr1from
feat/agent-tunnel-identity-pr2
Closed

feat(agent): derive QUIC endpoint from enrollment URL host#1795
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 2 commits into
feat/agent-tunnel-identity-pr1from
feat/agent-tunnel-identity-pr2

Conversation

@irvingoujAtDevolution
Copy link
Copy Markdown
Contributor

Summary

Second of three PRs implementing the agent-tunnel identity refactor
described in AGENT_TUNNEL_IDENTITY_DESIGN.md. This PR is agent-only.

With #1794 (PR 1) the gateway now returns quic_port separately from
the legacy quic_endpoint. This PR teaches the agent to derive the QUIC
dial target from the host the admin already chose for enrollment
(jet_gw_url) rather than whatever hostname the gateway happens to
advertise in quic_endpoint. The host the agent uses is therefore
guaranteed to be one the agent's network can reach (it just did, during
enrollment).

Scope (per spec PR 2):

  • Parse jet_gw_url host from the enrollment JWT.
  • Add format_endpoint(host, port) helper that handles DNS, IPv4, and
    bracketed IPv6 correctly ([fd00::7]:4433 vs 10.10.0.7:4433).
  • Prefer quic_port from the enrollment response when present; fall back
    to parsing quic_endpoint for backward compatibility with older
    gateways during the rollout window.
  • Write agent.json::Tunnel.GatewayEndpoint from the new logic.

Dependency

This PR depends on #1794 (gateway returns quic_port). It is the base
for #pr3 (installer).

Spec

See AGENT_TUNNEL_IDENTITY_DESIGN.md (PR 2 section).

Test plan

  • cargo test -p devolutions-agent passes
  • Unit tests for format_endpoint covering IPv4, IPv6, DNS
  • End-to-end: agent enrolls via IP literal, QUIC dials same IP, TLS
    SAN validates against multi-SAN cert from PR 1

…uic_port

Companion to the gateway-side identity refactor. The agent now composes the
QUIC dial target from `(jet_gw_url.host, quic_port)` rather than blindly
trusting whatever `quic_endpoint` the gateway returned. The host the agent
uses is the host the operator already proved is reachable from this agent's
network (the host the enrollment HTTP call landed on); the gateway only tells
the agent which UDP port to dial.

`EnrollResponse` now accepts both shapes during the compat window:

- New gateways send both `quic_endpoint` (legacy) and `quic_port` (new). The
  agent prefers `quic_port` and pairs it with the enrollment URL host.
- Older gateways send only `quic_endpoint`. The agent parses the port off
  that and still pairs it with the enrollment URL host so the old SAN-mismatch
  symptom (gateway substitutes its `conf.hostname` and breaks DNS resolution
  on the agent side) cannot recur on either side of the upgrade.

`format_endpoint` handles DNS, IPv4, and IPv6 hosts with proper bracketing
for IPv6 literals (`[fd00::7]:4433`).

Issue: DGW-Agent-Tunnel-Identity
@irvingoujAtDevolution
Copy link
Copy Markdown
Contributor Author

Closing — not authorized; will be reopened after explicit owner approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant