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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/openshell-driver-mxc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ openshell-policy = { path = "../openshell-policy" }
base64 = { workspace = true }
rustls = { workspace = true }
serde_json = { workspace = true }
# Parse the shipped gateway templates in cross-platform drift guards.
toml = { workspace = true }
# Used by the drift guard test (handled_fields_inventory) to parse YAML into a
# generic serde_json::Value for key enumeration.
serde_yml = { workspace = true }
Expand Down
48 changes: 48 additions & 0 deletions crates/openshell-driver-mxc/examples/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
OpenShell MXC Windows inference demos
====================================

These two demos exercise the full gateway -> MXC processContainer path:

Local inference (Hello World)
powershell -NoProfile -ExecutionPolicy Bypass -File .\run-ollama-test.ps1

Cloud inference (T1)
$env:NV_API_KEY = "nvapi-..."
powershell -NoProfile -ExecutionPolicy Bypass -File .\run-inference-test.ps1

Prerequisites
-------------

- Windows 11 build 26300.8553 or newer with MXC processContainer support.
- openshell-gateway.exe and openshell.exe beside these files, or explicit
-GatewayPath and -CliPath arguments.
- wxc-exec.exe beside these files, on PATH, named by
OPENSHELL_WXC_EXEC_PATH, or passed with -WxcExecPath.
- Local demo: an Ollama-compatible service on 127.0.0.1:11434 by default.
Override -OllamaHost, -OllamaPort, and -Model when needed.
- Cloud demo: NV_API_KEY and outbound HTTPS to integrate.api.nvidia.com.

The runners use a unique temporary share directory and an available loopback
gateway port for each run. They never require C:\mxc-kit, C:\work, a fixed
gateway port, or edits to the checked-in templates. Missing prerequisites fail
before sandbox creation with a diagnostic naming the parameter or environment
variable that can supply them.

Security model
--------------

Both demos use the fail-closed process_container backend. Their rendered policy
grants only the per-run share and the one requested endpoint, and no broad
AppContainer network capability is enabled. Cloud traffic traverses OpenShell's
enforcing CONNECT proxy. For local Ollama only, curl bypasses proxy variables
for the requested loopback hostname because the proxy's SSRF defense rejects
all loopback destinations; MXC still limits direct traffic to host loopback. This
inherits the driver's documented limitation that governed MXC sandboxes can
reach other host-loopback ports and must not be treated as loopback-service
isolation. The cloud key is passed with `--env-from NV_API_KEY`, is not placed in
argv or written to the results directory, and is never printed.

Each run leaves a results-* directory containing the rendered TOML and policy,
gateway logs, response artifacts, and summary.txt. The script exits 0 only when
the sandbox creates successfully and the expected inference response is
observed. Use -KeepArtifacts to retain the temporary share for debugging.
24 changes: 24 additions & 0 deletions crates/openshell-driver-mxc/examples/inference.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Template rendered by run-inference-test.ps1 into its per-run results directory.
version: 1

filesystem_policy:
include_workdir: false
read_only: []
read_write:
- "__OPENSHELL_DEMO_SHARE__"

network_policies:
nvidia_inference:
name: nvidia-inference
endpoints:
- host: integrate.api.nvidia.com
port: 443
protocol: rest
# Chat completions use POST.
access: read-write
enforcement: enforce
binaries:
- path: '__CMD_EXE__'
19 changes: 19 additions & 0 deletions crates/openshell-driver-mxc/examples/mxc-inference.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Gateway template for the cloud-inference (T1) demo. The runner resolves
# wxc-exec and writes a disposable copy. NV_API_KEY is supplied at sandbox
# creation with --env-from and is never stored in this file.

[openshell]
version = 2

[openshell.drivers.mxc]
wxc_exec_path = "wxc-exec.exe"
backend = "process_container"
default_configuration_id = "composable"
pc_least_privilege = false
pc_capabilities = []
egress_proxy = true
egress_proxy_addr = "127.0.0.1:0"
debug = false
21 changes: 21 additions & 0 deletions crates/openshell-driver-mxc/examples/mxc-ollama.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Gateway template for the local-inference demo. run-ollama-test.ps1 resolves
# wxc-exec and writes a disposable copy; workload command, cwd, and environment
# are sandbox-scoped and passed to `openshell sandbox create`.

[openshell]
version = 2

[openshell.drivers.mxc]
wxc_exec_path = "wxc-exec.exe"
backend = "process_container"
default_configuration_id = "composable"
pc_least_privilege = false
pc_capabilities = []
egress_proxy = true
# The address is a seed. The driver reserves a distinct ephemeral port for each
# sandbox, so this does not claim a machine-specific port.
egress_proxy_addr = "127.0.0.1:0"
debug = false
24 changes: 24 additions & 0 deletions crates/openshell-driver-mxc/examples/ollama.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Template rendered by run-ollama-test.ps1 into its per-run results directory.
version: 1

filesystem_policy:
include_workdir: false
read_only: []
read_write:
- "__OPENSHELL_DEMO_SHARE__"

network_policies:
local_ollama:
name: local-ollama
endpoints:
- host: "__OLLAMA_HOST__"
port: __OLLAMA_PORT__
protocol: rest
# Both /api/tags (GET) and /api/generate (POST) are required.
access: read-write
enforcement: enforce
binaries:
- path: '__CMD_EXE__'
Loading
Loading