Commit 54f87d2
committed
refactor(agent-tunnel): JWT-only enrollment, drop server-side mint
DVLS holds the provisioner private key, the gateway holds the public key
and verifies statelessly. The gateway-side enrollment-string mint
endpoint was the wrong shape: it required the gateway to hold issuance
state (the in-memory `EnrollmentTokenStore`), which broke HA (a token
could only be redeemed against the specific gateway node that minted it,
and a restart silently invalidated unredeemed tokens).
This PR removes that path entirely. DVLS signs an enrollment JWT with
its `gateway.agent.enroll` scope; the agent presents the JWT as the
Bearer token on `POST /jet/tunnel/enroll`; the gateway verifies the
signature against the configured provisioner public key. No state on
the gateway, no per-node affinity, no restart hazards.
Companion changes:
- Token: rename `gateway.tunnel.enroll` to `gateway.agent.enroll` (the
scope governs agent management, not the tunnel transport). Add the
matching `gateway.agent.read` scope. Both extractors
(`AgentManagementReadAccess` / `WriteAccess`) accept the new scopes
alongside the existing `Wildcard` / `ConfigWrite` / `DiagnosticsRead`
for back-compat with callers that predate the rename.
- Agent CLI (`up`): the JWT itself becomes the enrollment artifact, so
`up --enrollment-string <jwt>` is the one-step bootstrap path.
`--enrollment-string` is decoded locally to populate `--gateway`,
`--name`, and the new `--quic-endpoint` / `--advertise-domains` flags.
CLI flags still take precedence over claim values.
- `EnrollResponse` no longer returns `quic_endpoint`. A running gateway
cannot know the address its agents can actually reach (Docker bridge
NAT, K8s service FQDN, split-horizon DNS, LB VIP) — that is operator
knowledge, supplied via the `jet_quic_endpoint` JWT claim or the
`--quic-endpoint` agent flag. The doc on `EnrollmentJwtClaims` spells
out the rationale.
- .NET utils: new `EnrollmentClaims` mirroring the Rust shape so DVLS
can sign the JWT directly via `TokenUtils.Sign`. Two new
`AccessScope` constants. Round-trip JSON tests for both. NuGet bumped
to 2026.4.27.
- `--advertise-domains` agent CLI flag (parallels `--advertise-routes`,
for hostname-based routing once the gateway side accepts domain
advertisements).1 parent 0475494 commit 54f87d2
13 files changed
Lines changed: 372 additions & 279 deletions
File tree
- crates/agent-tunnel/src
- devolutions-agent/src
- devolutions-gateway/src
- api
- utils/dotnet
- Devolutions.Gateway.Utils.Tests
- Devolutions.Gateway.Utils
- src
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
33 | 32 | | |
34 | 33 | | |
35 | 34 | | |
36 | | - | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
| |||
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 46 | | |
53 | 47 | | |
54 | 48 | | |
| |||
148 | 142 | | |
149 | 143 | | |
150 | 144 | | |
151 | | - | |
152 | 145 | | |
153 | 146 | | |
154 | 147 | | |
155 | 148 | | |
156 | 149 | | |
157 | | - | |
158 | 150 | | |
159 | 151 | | |
160 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
0 commit comments