Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 60 additions & 1 deletion crates/openshell-driver-vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,72 @@ Select the VM driver with `--compute-driver vm`, `OPENSHELL_COMPUTE_DRIVER=vm`,
| `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. |
| `proxy_connect_by_hostname` | unset | Send hostnames rather than validated IPs in CONNECT. Last resort for proxies whose ACLs reject IP CONNECT targets. |
| `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`. |
| `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. |
| `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). |
| `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. |
| `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. |

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.

See [`openshell-gateway --help`](../openshell-server/src/cli.rs) for the gateway process flag surface.

## Provider workload identity

Set `provider_spiffe_workload_api_socket` in the driver table, or
`OPENSHELL_VM_PROVIDER_SPIFFE_WORKLOAD_API_SOCKET`, to give host supervisors a
SPIFFE Workload API socket for provider token grants. Each host supervisor
receives the path in `OPENSHELL_PROVIDER_SPIFFE_WORKLOAD_API_SOCKET`. The guest
receives nothing.

The driver advertises the `openshell.compute.provider-workload-identity`
capability when all of these hold:

- The gateway selected the mode in `Configure`, or the driver runs standalone.
- The socket is configured.
- The host supervisor reaches the gateway over HTTPS, or over HTTP on a
numeric loopback address.
- The host supervisor's `provider-workload-identity-probe <socket>` command
reports that it sees the socket.

The driver runs these checks on each `GetCapabilities` call, with the
supervisor binary that it launches. If a check fails, the driver logs the
reason and omits the capability. The driver checks the embedded supervisor
against its SHA-256 before every use. An `OPENSHELL_VM_SUPERVISOR_BIN` override
is not pinned, so the probe describes the file at that path at the time of the
call.

A launch bundle in this mode carries the sandbox's stable SPIFFE ID and a
launch ID, which is the stable ID followed by `/launch/<runtime generation>`.
`CreateSandbox` and `StartSandbox` check both against the sandbox and
generation of the request, and reject the request before any state changes if
they do not match. The supervisor reads the IDs from its launch bundle.

The launch ID changes exactly when the gateway issues a new runtime generation.
Without this mode, the driver refuses `StartSandbox` for a running VM when the
request carries another generation. In this mode, `StartSandbox` for a running
VM compares the launch ID in the request with the one in the saved bundle:

- If the request names another launch, the driver stops the VM launcher and its
host supervisor, then starts both with the new bundle and the existing
overlay. Both restart because the guest boundary configuration and the
host-to-guest channel keys are created from the bundle at boot.
- If the request names the saved launch, it behaves as it does without this
mode. An empty bundle changes nothing. A non-empty bundle restarts the VM
with that bundle, so a retried start restarts the VM again. A VM that was
created and never started records no gateway generation, and the driver
refuses such a start for it.

After a driver restart, the driver relaunches a running-intent sandbox with its
saved bundle, so a new supervisor process carries the saved launch ID.

The driver does not attest supervisors. It starts every host supervisor
itself, as its own user and from one executable. The Unix selectors that SPIRE
provides (user, group, path, and SHA-256) are therefore the same for every
supervisor from one install: a registration entry that matches one supervisor
matches all of them, and each can obtain the identity registered for any
sandbox. Per-sandbox identity on this driver needs an external attestor that
maps a supervisor process to its sandbox launch. The driver does not provide
one.

## Verifying the gateway

The gateway is auto-registered by `mise run gateway:vm`. In another terminal:
Expand Down
Loading
Loading