Skip to content

Commit 2ce134e

Browse files
committed
feat(vm): support provider workload identity
Let the MicroVM driver give its host supervisors a Workload API socket. - A new provider_spiffe_workload_api_socket setting names a Unix socket on the driver host. The host supervisor receives its path. The guest TCP settings for the Workload API remain unused, and a configured endpoint now logs a warning. - The driver advertises provider workload identity when the mode is selected or the driver runs standalone, the socket is configured, the supervisor can reach the gateway over HTTPS or numeric loopback, and the supervisor binary can see the socket. - A start whose launch differs from the running supervisor's restarts the VM launcher and the host supervisor and keeps the overlay. Every host supervisor from one install has the same user and executable, so binding a supervisor process to its launch needs an external attestor. Signed-off-by: Shiju <shiju@nvidia.com>
1 parent 7770130 commit 2ce134e

6 files changed

Lines changed: 520 additions & 24 deletions

File tree

‎crates/openshell-driver-vm/README.md‎

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,72 @@ Select the VM driver with `--compute-driver vm`, `OPENSHELL_COMPUTE_DRIVER=vm`,
181181
| `proxy_auth_allow_insecure` | unset | Required with `proxy_auth_file` against an `http://` proxy: acknowledges that Basic auth is cleartext on the connection to the proxy. |
182182
| `proxy_connect_by_hostname` | unset | Send hostnames rather than validated IPs in CONNECT. Last resort for proxies whose ACLs reject IP CONNECT targets. |
183183
| `proxy_ca_bundle` | unset | Gateway-host PEM CA bundle trusted for the corporate proxy and TLS-intercepted server certificates. The driver validates it and stages it at a fixed non-secret guest path in the protected overlay. Requires `https_proxy`. |
184-
| `provider_spiffe_workload_api_tcp_endpoint` | unset | Explicit guest-reachable `tcp:IP:port` SPIFFE Workload API listener for provider token exchange. It requires `provider_spiffe_allow_guest_tcp = true`; a host UNIX socket is never silently exposed to a VM guest. |
184+
| `provider_spiffe_workload_api_socket` | unset | Absolute path of a SPIFFE Workload API Unix socket on the driver host. Each host supervisor receives the path in its environment. The socket and its credentials never enter a VM. See [Provider workload identity](#provider-workload-identity). |
185+
| `provider_spiffe_workload_api_tcp_endpoint`, `provider_spiffe_allow_guest_tcp` | unset | Legacy guest TCP settings. They have no effect: the host supervisor never used them. The driver still validates the pair, so an endpoint requires `provider_spiffe_allow_guest_tcp = true`, and logs a warning when an endpoint is set. |
185186
| `enable_bind_mounts` | `false` | Allow per-sandbox `driver_config.vm.mounts` host directory shares (libkrun virtiofs only). The driver writes a `tag\ttarget\tmode` manifest to `/.openshell/mounts.manifest` in the overlay, and guest init mounts each share after `/sandbox` ownership fixups. Rejected while resource admission is enabled. |
186187
187188
The proxy settings are operator-owned and deployment-level: they are not accepted through `template.driver_config.vm`, and the driver passes them only to native host control. Every present-but-invalid value is fatal at gateway or sandbox startup rather than degrading to a direct dial.
188189
189190
See [`openshell-gateway --help`](../openshell-server/src/cli.rs) for the gateway process flag surface.
190191
192+
## Provider workload identity
193+
194+
Set `provider_spiffe_workload_api_socket` in the driver table, or
195+
`OPENSHELL_VM_PROVIDER_SPIFFE_WORKLOAD_API_SOCKET`, to give host supervisors a
196+
SPIFFE Workload API socket for provider token grants. Each host supervisor
197+
receives the path in `OPENSHELL_PROVIDER_SPIFFE_WORKLOAD_API_SOCKET`. The guest
198+
receives nothing.
199+
200+
The driver advertises the `openshell.compute.provider-workload-identity`
201+
capability when all of these hold:
202+
203+
- The gateway selected the mode in `Configure`, or the driver runs standalone.
204+
- The socket is configured.
205+
- The host supervisor reaches the gateway over HTTPS, or over HTTP on a
206+
numeric loopback address.
207+
- The host supervisor's `provider-workload-identity-probe <socket>` command
208+
reports that it sees the socket.
209+
210+
The driver runs these checks on each `GetCapabilities` call, with the
211+
supervisor binary that it launches. If a check fails, the driver logs the
212+
reason and omits the capability. The driver checks the embedded supervisor
213+
against its SHA-256 before every use. An `OPENSHELL_VM_SUPERVISOR_BIN` override
214+
is not pinned, so the probe describes the file at that path at the time of the
215+
call.
216+
217+
A launch bundle in this mode carries the sandbox's stable SPIFFE ID and a
218+
launch ID, which is the stable ID followed by `/launch/<runtime generation>`.
219+
`CreateSandbox` and `StartSandbox` check both against the sandbox and
220+
generation of the request, and reject the request before any state changes if
221+
they do not match. The supervisor reads the IDs from its launch bundle.
222+
223+
The launch ID changes exactly when the gateway issues a new runtime generation.
224+
Without this mode, the driver refuses `StartSandbox` for a running VM when the
225+
request carries another generation. In this mode, `StartSandbox` for a running
226+
VM compares the launch ID in the request with the one in the saved bundle:
227+
228+
- If the request names another launch, the driver stops the VM launcher and its
229+
host supervisor, then starts both with the new bundle and the existing
230+
overlay. Both restart because the guest boundary configuration and the
231+
host-to-guest channel keys are created from the bundle at boot.
232+
- If the request names the saved launch, it behaves as it does without this
233+
mode. An empty bundle changes nothing. A non-empty bundle restarts the VM
234+
with that bundle, so a retried start restarts the VM again. A VM that was
235+
created and never started records no gateway generation, and the driver
236+
refuses such a start for it.
237+
238+
After a driver restart, the driver relaunches a running-intent sandbox with its
239+
saved bundle, so a new supervisor process carries the saved launch ID.
240+
241+
The driver does not attest supervisors. It starts every host supervisor
242+
itself, as its own user and from one executable. The Unix selectors that SPIRE
243+
provides (user, group, path, and SHA-256) are therefore the same for every
244+
supervisor from one install: a registration entry that matches one supervisor
245+
matches all of them, and each can obtain the identity registered for any
246+
sandbox. Per-sandbox identity on this driver needs an external attestor that
247+
maps a supervisor process to its sandbox launch. The driver does not provide
248+
one.
249+
191250
## Verifying the gateway
192251
193252
The gateway is auto-registered by `mise run gateway:vm`. In another terminal:

0 commit comments

Comments
 (0)