Skip to content

Commit 9607064

Browse files
committed
feat(vm): support verified provider workload identity
Let the MicroVM driver give its host supervisors a Workload API socket and make their launches replayable. - A new provider_spiffe_workload_api_socket setting names a Unix socket on the driver host. The host supervisor receives its path. The legacy guest TCP settings are accepted and ignored with a warning. - The driver advertises provider workload identity and ordered provider start when the socket is configured and the supervisor binary can see it. Verified launches run a checked copy of that binary. - StartSandbox and StopSandbox run under the launch journal. VM launchers and host supervisors exit with their driver, so a replay reports a launch that is no longer running as retired and the gateway issues a new one. - One driver owns a state directory. Launch processes inherit its lock. A restarted driver logs while it waits for them to exit and fails after a bound. A restored sandbox in this mode waits for a fresh gateway launch. - Launchers and supervisors exit if they were already reparented when the parent-death signal was armed. - StartSandbox for a running VM compares the request with the saved launch bundle. A new bundle for the running generation restarts the VM, where it used to be rejected. The driver logs the supervisor PID and launch ID for diagnosis. Binding a host supervisor process to its launch needs an external attestor. Signed-off-by: Shiju <shiju@nvidia.com>
1 parent a0846a5 commit 9607064

11 files changed

Lines changed: 1509 additions & 123 deletions

File tree

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,40 @@ 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 SPIFFE Workload API Unix socket path on the VM driver host. The host supervisor uses it for provider token grants. |
185185
| `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. |
186186
187187
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.
188188
189+
Configure the SPIFFE socket in the driver table or with
190+
`OPENSHELL_VM_PROVIDER_SPIFFE_WORKLOAD_API_SOCKET`. The socket and credentials
191+
stay on the host. For per-sandbox provider identity, configure the issuer to
192+
authorize each host supervisor for its sandbox and current launch. The VM
193+
driver starts every host supervisor itself, as its own user and from one
194+
executable. SPIRE's built-in Unix selectors (user, group, path, and SHA-256)
195+
are therefore the same for every supervisor of one driver: a registration that
196+
matches one supervisor matches all of them. Provide an external attestor that
197+
maps each supervisor process to a sandbox launch. The driver logs the
198+
supervisor PID and launch ID when it starts a verified supervisor. That line is
199+
diagnostic only. It carries no process start time, and a PID can be reused.
200+
201+
Verified launches run a copy of the supervisor at
202+
`<state-dir>/host-runtime/verified/openshell-supervisor-<sha256>`. The path
203+
changes with every supervisor upgrade, and the driver removes the older copies.
204+
205+
In verified mode, VM driver recovery waits for a fresh gateway launch bundle
206+
before starting a recovered sandbox. A standalone driver with a host Workload
207+
API socket also waits for the gateway. If the gateway stays up when the driver
208+
restarts, stop and start the sandbox to send a new bundle. If you set
209+
`OPENSHELL_VM_SUPERVISOR_BIN`, use a supervisor that supports verified provider
210+
workload identity. The driver copies and probes that executable for its
211+
verified launches, and checks the copy before each one. Restart the driver to
212+
pick up changes to the override, or if the copy is removed or changed.
213+
214+
The driver accepts the legacy
215+
`provider_spiffe_workload_api_tcp_endpoint` and `provider_spiffe_allow_guest_tcp`
216+
settings for configuration compatibility and logs a warning if an endpoint is set.
217+
189218
See [`openshell-gateway --help`](../openshell-server/src/cli.rs) for the gateway process flag surface.
190219
191220
## Verifying the gateway
@@ -255,6 +284,15 @@ stops its launcher while retaining the launch request and `overlay.ext4`.
255284
After driver initialization, the gateway sends the idempotent `StartSandbox`
256285
request for that retained intent. Explicitly stopped sandboxes remain excluded.
257286
287+
Run one VM driver per state directory. The driver holds an exclusive lock on
288+
`<state-dir>/.driver-owner` and keeps provider launch receipts under
289+
`provider-launches/` in that directory. On restart, the new driver waits for
290+
the old driver, VM launchers, and host supervisors to release the lock. It logs
291+
the wait every 30 seconds and fails to start if the lock is still held after
292+
three and a half minutes.
293+
After the driver exits, the gateway uses a fresh provider launch ID for the
294+
next host supervisor. A retry against a live launch reuses its receipt.
295+
258296
Stop writes a marker in the sandbox state directory before terminating
259297
the launcher and releasing host GPU and network allocations. It retains
260298
`sandbox.pb`, `overlay.ext4`, and lifecycle-extension state. Startup registers

0 commit comments

Comments
 (0)