Skip to content

Commit c35d50e

Browse files
committed
fix(docker): close boundary lifecycle gaps
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
1 parent f2e1ed0 commit c35d50e

5 files changed

Lines changed: 343 additions & 425 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/openshell-driver-docker/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ http = { workspace = true }
4242
rand = { workspace = true }
4343
sha2 = { workspace = true }
4444
rustix = { workspace = true }
45+
libc = "0.2"
4546
tar = "0.4"
4647
tempfile = "3"
4748

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,22 @@ boundary owns the process tree, exec/signal/wait/PTY operations, loopback port
3939
forwarding, procfs binary identity, and the workload network namespace. The
4040
boundary receives no gateway JWT, client TLS private key, or policy authority.
4141

42-
The driver bind-mounts the boundary socket from a short, digest-keyed runtime
43-
directory under `/tmp/openshell-docker-boundaries`. This keeps the host endpoint
44-
below Linux's Unix-socket path limit even when the gateway state directory is
45-
deeply nested. The full protected topology and gateway material remain in the
46-
normal driver state directory, and sandbox cleanup removes both locations.
42+
The driver bind-mounts the boundary socket from a short, digest-keyed directory
43+
under `$XDG_RUNTIME_DIR/openshell/docker-boundary-runtime`, falling back to the
44+
XDG state directory when no runtime directory exists. The driver rejects
45+
symlinked, incorrectly owned, or overly permissive pre-existing components and
46+
checks the final path against the Unix-socket length limit. The full protected
47+
topology and gateway material remain in the normal driver state directory, and
48+
sandbox cleanup removes both locations.
4749

4850
## Stop and Start
4951

5052
Stop terminates host control and stops the managed container without removing
5153
it. Docker retains the container writable layer, attached volumes, labels, and
52-
the protected driver topology. Start starts that same container and recreates
53-
host control, so files in the resolved OCI workspace remain available. A
54+
the protected driver topology. Stop removes the transient boundary and SSH
55+
socket names; Start validates and removes any safe stale sockets before starting
56+
that same container and recreating host control. Files in the resolved OCI
57+
workspace remain available. A
5458
durably stopped sandbox is excluded from gateway startup recovery and stays
5559
stopped across gateway restarts. Delete force-removes the container and the
5660
driver-owned boundary directory.
@@ -196,7 +200,11 @@ When no endpoint is configured, the driver uses
196200
`host.openshell.internal:<gateway-port>` with the appropriate HTTP or HTTPS
197201
scheme. Set `host_gateway_ip` only when the host has an explicit, locally
198202
assigned address that containers should use for callbacks; package-managed
199-
macOS gateways should leave it unset.
203+
macOS gateways should leave it unset. The current boundary topology requires
204+
the Docker daemon and gateway to share bind-mounted Unix socket inodes. The
205+
driver fails during initialization for Docker Desktop, Colima, Lima, Rancher
206+
Desktop, OrbStack, and other detected VM-backed daemons instead of starting a
207+
workload whose host control channel cannot become operational.
200208

201209
For HTTPS endpoints, the server certificate must include the endpoint host as a
202210
subject alternative name. The client TLS bundle is exposed only to host control
@@ -212,7 +220,10 @@ HTTP endpoints reject TLS material because the supervisor would not use it.
212220

213221
The driver writes template and sandbox environment into the protected boundary
214222
config. Boundary mode exposes that map only to workload children. Host control
215-
owns these security-critical keys:
223+
starts with an empty inherited environment and receives only driver-owned
224+
values. It also arms Linux `PDEATHSIG` with a parent-PID race check so a killed
225+
gateway cannot leave an orphan host-control process. Host control owns these
226+
security-critical keys:
216227

217228
- `OPENSHELL_ENDPOINT`
218229
- `OPENSHELL_SANDBOX_ID`

0 commit comments

Comments
 (0)