Skip to content
Merged
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
14 changes: 14 additions & 0 deletions .agents/skills/debug-openshell-cluster/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ Common findings:
- Sandbox image missing or pull denied: verify image reference and registry credentials.
- Sandbox fails before readiness with an identity-resolution error: inspect the image's OCI `USER` and matching `/etc/passwd` and `/etc/group` entries, or explicitly set both process identity fields in policy. Root and missing identities are rejected.
- Supervisor cannot call back: check callback endpoint and gateway logs.
- Gateway exits before becoming healthy with a callback-listener discovery
error: inspect `podman info --debug`, the configured Podman network, and the
host's IPv4 default route. Rootless pasta uses the private source address
selected by that route; rootful Podman uses the bridge gateway address.
- Callback discovery reports that the requested address equals the primary
listener: configure a distinct primary address. For Podman Machine, keep the
IPv4 loopback callback separate by using an IPv6-loopback primary such as
`[::1]:17670`.
- Rootless slirp4netns, another named helper, or missing helper metadata
requires an explicitly remote `grpc_endpoint`. An explicit `host_gateway_ip`
cannot bypass slirp4netns host-loopback isolation. Do not work around
discovery failures by broadening the primary gateway listener to `0.0.0.0`.

### Step 6: Check Kubernetes Helm Gateways

Expand Down Expand Up @@ -392,6 +404,8 @@ openshell logs <sandbox-name>
|---|---|---|
| `openshell status` fails | Gateway endpoint unreachable or auth mismatch | `openshell gateway info`, gateway logs |
| Gateway starts but sandbox create fails | Compute driver cannot reach runtime | Docker/Podman/Kubernetes/VM driver logs |
| Gateway exits while resolving compute-driver listener requirements | Callback alias topology is unsupported, the Podman network cannot be inspected, or the selected address is not private/authorized | Gateway startup error, `podman info --debug`, Podman network inspection, host IPv4 default route |
| Admin, health, reflection, or HTTP request is denied on a Docker/Podman callback address | Negotiated callback listeners intentionally expose only sandbox-callable gRPC methods | Retry through the gateway's primary endpoint; inspect the listener-purpose startup log if the address was unexpected |
| Docker or Podman sandbox never registers | Wrong callback endpoint or supervisor startup failure | Gateway logs and sandbox container logs |
| Docker GPU e2e fails before GPU sandbox comparison | NVIDIA CDI specs are missing or Docker has not discovered them | `docker info --format '{{json .DiscoveredDevices}}'`, `/etc/cdi`, `/var/run/cdi`, `nvidia-cdi-refresh.service` |
| Kubernetes gateway pod pending | PVC unbound, taint, selector, or insufficient resources | `kubectl -n openshell describe pod <pod>` |
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,17 @@ jobs:
# Run directly on the Ubuntu host so the test observes the host's AppArmor
# and unprivileged-user-namespace policy. A privileged job container masks
# the restrictions that production rootless Podman installations enforce.
# Ubuntu 26.04 provides the supported Podman 5.x and pasta combination.
# Re-add older/slirp4netns environments when direct callbacks through a
# rootless-network namespace relay are supported.
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
# Ubuntu 24.04 matches the environment reported in #2069 and ships
# Podman 4.x. The probe records whether AppArmor blocks the drop.
- runner: ubuntu-24.04
podman_major: "4"
podman_package_version: "4.9.3+ds1-1ubuntu0.2"
conmon_package_version: "2.1.10+ds1-1build2"
# Ubuntu 26.04 provides the supported Podman 5.x coverage for
# comparison with the Ubuntu 24.04 environment.
# Keep package versions explicit so hosted-runner tool overrides
# cannot silently change the supported test environment.
- runner: ubuntu-26.04
podman_major: "5"
podman_package_version: "5.7.0+ds2-3build1"
Expand Down Expand Up @@ -199,7 +196,6 @@ jobs:
pkg-config \
"conmon=${{ matrix.conmon_package_version }}" \
"podman=${{ matrix.podman_package_version }}" \
slirp4netns \
uidmap
# Hosted runners can place newer Podman and conmon binaries under
# /usr/local ahead of Ubuntu's packages. Select the distro CLI and
Expand Down Expand Up @@ -238,6 +234,7 @@ jobs:
test "$(command -v podman)" = "/usr/bin/podman"
test "$(podman info --format '{{.Host.Conmon.Path}}')" = "/usr/bin/conmon"
test "$(podman info --format '{{.Host.Security.Rootless}}')" = "true"
test "$(podman info --format '{{.Host.RootlessNetworkCmd}}')" = "pasta"
test "$(sudo sysctl -n kernel.apparmor_restrict_unprivileged_userns)" = "1"
echo "=== host ==="
uname -a
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ jobs:
cat release/openshell.rb

- name: Attest VM driver artifacts
uses: actions/attest@f7c74d28b9d84cb8768d0b8ca14a4bac6ef463e6 # v4.2.0
uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
with:
subject-path: |
release/openshell-driver-vm-x86_64-unknown-linux-gnu.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ jobs:
cat release/openshell.rb

- name: Attest VM driver artifacts
uses: actions/attest@f7c74d28b9d84cb8768d0b8ca14a4bac6ef463e6 # v4.2.0
uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
with:
subject-path: |
release/*.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-vm-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ jobs:
merge-multiple: true

- name: Attest VM runtime artifacts
uses: actions/attest@f7c74d28b9d84cb8768d0b8ca14a4bac6ef463e6 # v4.2.0
uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
with:
subject-path: |
release/vm-runtime-linux-aarch64.tar.zst
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ These pipelines connect skills into end-to-end workflows. Individual skill files
| `crates/openshell-bootstrap/` | Gateway metadata | Gateway registration metadata, auth token storage, mTLS bundle storage |
| `crates/openshell-gateway-interceptors/` | Gateway interceptors | Intercepts and transforms configured gRPC requests at the gateway routing boundary |
| `crates/openshell-ocsf/` | OCSF logging | OCSF v1.7.0 event types, builders, shorthand/JSONL formatters, tracing layers |
| `crates/openshell-otel/` | OpenTelemetry support | Shared OTLP trace provider, resource, and tracing-layer construction |
| `crates/openshell-core/` | Shared core | Common types, configuration, error handling |
| `crates/openshell-sdk/` | Shared client SDK | Async Rust gateway client (gRPC transport, TLS, OIDC refresh, edge tunnel); consumed by CLI, TUI, and `@openshell/sdk` |
| `crates/openshell-providers/` | Provider management | Credential provider backends |
Expand Down
20 changes: 18 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ metrics-exporter-prometheus = { version = "0.18", default-features = false, feat
# Unix/Process
nix = { version = "0.29", features = ["signal", "process", "user", "fs", "term"] }
rustix = { version = "1.1", features = ["process"] }
socket2 = "0.6"

# Serialization
serde = { version = "1", features = ["derive"] }
Expand Down
31 changes: 29 additions & 2 deletions architecture/gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ health, metrics, or tunnel routes. The plaintext service router also rejects
browser requests whose Fetch Metadata, Origin, or Referer headers indicate a
cross-origin or sibling-subdomain request.

Docker and Podman may negotiate additional listeners that make the gateway
reachable from their local sandbox network topology. Those listeners accept
only gRPC methods classified as sandbox-callable by the gateway's generated
authorization metadata. They reject user and administrator APIs, health,
reflection, non-callback inference APIs, and HTTP routes before normal request
authentication. The operator-configured primary listener retains the full
multiplexed API surface.

The gateway rejects a callback requirement that resolves to the exact primary
listener address because one socket cannot preserve two authorization scopes.
A wildcard primary listener may cover a callback address because the accepted
connection's concrete local address still selects the callback-only scope.

The `rpc_auth` classification is also the source of truth for negotiated
listener exposure: marking an RPC as `sandbox` or `dual` makes it callable on
these listeners. Review such changes as both authorization and network-surface
changes. Listener requirements are currently authorized only for the built-in
Docker and Podman drivers. Operator-granted listener capabilities for external
drivers are tracked in
[#2539](https://github.com/NVIDIA/OpenShell/issues/2539).

Operators can configure a gateway-wide gRPC request rate limit. The limit is
applied only to gRPC API traffic after protocol multiplexing; health, metrics,
and local sandbox-service HTTP routes are not rate limited by this control.
Expand Down Expand Up @@ -615,7 +636,8 @@ replace the existing logging paths.
export: the table's presence is the on-switch, and `OTEL_EXPORTER_OTLP_ENDPOINT`
is ignored so enablement has a single source. TOML decides whether and where
to export; the SDK's `OTEL_*` variables tune how. Transport is OTLP over gRPC
only.
only. Shared provider, resource, and tracing-layer construction lives in
`openshell-otel`.

Span emission requires no per-handler instrumentation. The `tower_http`
`TraceLayer` in `multiplex.rs` opens a span per inbound request, and that span
Expand Down Expand Up @@ -660,7 +682,12 @@ system entry instead of pretending to delete package-manager owned state.
- Podman-backed macOS gateways use gvproxy's host-loopback IP for sandbox host
aliases by default so stale Podman machine images do not need Podman's
`host-gateway` resolver. Linux Podman keeps the resolver unless
`host_gateway_ip` is configured.
`host_gateway_ip` is configured. Rootful Podman can request its exact bridge
gateway listener. Rootless Podman explicitly reporting pasta requests the
private IPv4 source selected by the host default route rather than an
arbitrary private interface. Slirp4netns, other helpers, and missing helper
metadata fail closed for local callbacks until a rootless-network namespace
relay is available.
- Gateway restarts recover persisted objects from storage, but live relay
streams must be re-established by supervisors.
- User-facing behavior changes must update published docs in `docs/`; this file
Expand Down
3 changes: 3 additions & 0 deletions crates/openshell-bootstrap/src/pki.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub const DEFAULT_SERVER_SANS: &[&str] = &[
"host.docker.internal",
"host.containers.internal",
"127.0.0.1",
"::1",
];

/// Generate a complete PKI bundle: CA, server cert, and client cert.
Expand Down Expand Up @@ -190,5 +191,7 @@ mod tests {
fn default_server_sans_include_local_container_hostnames() {
assert!(DEFAULT_SERVER_SANS.contains(&"host.docker.internal"));
assert!(DEFAULT_SERVER_SANS.contains(&"host.containers.internal"));
assert!(DEFAULT_SERVER_SANS.contains(&"127.0.0.1"));
assert!(DEFAULT_SERVER_SANS.contains(&"::1"));
}
}
40 changes: 26 additions & 14 deletions crates/openshell-driver-docker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ use openshell_core::progress::{
use openshell_core::proto::compute::v1::{
CreateSandboxRequest, CreateSandboxResponse, DeleteSandboxRequest, DeleteSandboxResponse,
DriverCondition, DriverPlatformEvent, DriverSandbox, DriverSandboxStatus,
DriverSandboxTemplate, GetCapabilitiesRequest, GetCapabilitiesResponse, GetSandboxRequest,
GetSandboxResponse, GpuResourceRequirements, ListSandboxesRequest, ListSandboxesResponse,
StopSandboxRequest, StopSandboxResponse, ValidateSandboxCreateRequest,
ValidateSandboxCreateResponse, WatchSandboxesDeletedEvent, WatchSandboxesEvent,
WatchSandboxesPlatformEvent, WatchSandboxesRequest, WatchSandboxesSandboxEvent,
compute_driver_server::ComputeDriver, watch_sandboxes_event,
DriverSandboxTemplate, GatewayListenerRequirement, GetCapabilitiesRequest,
GetCapabilitiesResponse, GetGatewayListenerRequirementsRequest,
GetGatewayListenerRequirementsResponse, GetSandboxRequest, GetSandboxResponse,
GpuResourceRequirements, ListSandboxesRequest, ListSandboxesResponse, StopSandboxRequest,
StopSandboxResponse, ValidateSandboxCreateRequest, ValidateSandboxCreateResponse,
WatchSandboxesDeletedEvent, WatchSandboxesEvent, WatchSandboxesPlatformEvent,
WatchSandboxesRequest, WatchSandboxesSandboxEvent, compute_driver_server::ComputeDriver,
gateway_listener_requirement::Selector, watch_sandboxes_event,
};
use openshell_core::proto_struct::{
deserialize_optional_non_empty_string_list, struct_to_json_value,
Expand Down Expand Up @@ -399,14 +401,6 @@ impl DockerComputeDriver {
Ok(driver)
}

#[must_use]
pub fn gateway_bind_addresses(&self) -> Vec<SocketAddr> {
match self.config.gateway_route {
DockerGatewayRoute::Bridge { bind_address, .. } => vec![bind_address],
DockerGatewayRoute::HostGateway => Vec::new(),
}
}

fn capabilities(&self) -> GetCapabilitiesResponse {
openshell_core::driver_utils::build_capabilities_response(
"docker",
Expand Down Expand Up @@ -1386,6 +1380,24 @@ impl ComputeDriver for DockerComputeDriver {
Ok(Response::new(self.capabilities()))
}

async fn get_gateway_listener_requirements(
&self,
_request: Request<GetGatewayListenerRequirementsRequest>,
) -> Result<Response<GetGatewayListenerRequirementsResponse>, Status> {
let requirements = match self.config.gateway_route {
DockerGatewayRoute::Bridge { bind_address, .. } => {
vec![GatewayListenerRequirement {
reason: "docker managed bridge gateway".to_string(),
selector: Some(Selector::ExactBindAddress(bind_address.to_string())),
}]
}
DockerGatewayRoute::HostGateway => Vec::new(),
};
Ok(Response::new(GetGatewayListenerRequirementsResponse {
requirements,
}))
}

async fn validate_sandbox_create(
&self,
request: Request<ValidateSandboxCreateRequest>,
Expand Down
42 changes: 40 additions & 2 deletions crates/openshell-driver-docker/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use openshell_core::progress::{
PROGRESS_STEP_STARTING_SANDBOX,
};
use openshell_core::proto::compute::v1::{
DriverResourceRequirements, DriverSandboxSpec, DriverSandboxTemplate, GpuResourceRequirements,
ResourceRequirements,
DriverResourceRequirements, DriverSandboxSpec, DriverSandboxTemplate,
GetGatewayListenerRequirementsRequest, GpuResourceRequirements, ResourceRequirements,
gateway_listener_requirement::Selector,
};
use std::fs;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
Expand Down Expand Up @@ -158,6 +159,43 @@ fn test_driver_with_config(config: DockerDriverRuntimeConfig) -> DockerComputeDr
}
}

#[tokio::test]
async fn gateway_listener_requirements_report_managed_bridge_address() {
let config = runtime_config();
let expected_address = match config.gateway_route {
DockerGatewayRoute::Bridge { bind_address, .. } => bind_address,
DockerGatewayRoute::HostGateway => panic!("test config must use a managed bridge"),
};
let driver = test_driver_with_config(config);

let response = driver
.get_gateway_listener_requirements(Request::new(GetGatewayListenerRequirementsRequest {}))
.await
.unwrap()
.into_inner();

assert_eq!(response.requirements.len(), 1);
assert_eq!(
response.requirements[0].selector,
Some(Selector::ExactBindAddress(expected_address.to_string()))
);
}

#[tokio::test]
async fn gateway_listener_requirements_are_empty_for_host_gateway_route() {
let mut config = runtime_config();
config.gateway_route = DockerGatewayRoute::HostGateway;
let driver = test_driver_with_config(config);

let response = driver
.get_gateway_listener_requirements(Request::new(GetGatewayListenerRequirementsRequest {}))
.await
.unwrap()
.into_inner();

assert!(response.requirements.is_empty());
}

#[test]
fn container_visible_endpoint_rewrites_loopback_hosts() {
assert_eq!(
Expand Down
12 changes: 11 additions & 1 deletion crates/openshell-driver-kubernetes/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
use futures::{Stream, StreamExt};
use openshell_core::proto::compute::v1::{
CreateSandboxRequest, CreateSandboxResponse, DeleteSandboxRequest, DeleteSandboxResponse,
GetCapabilitiesRequest, GetCapabilitiesResponse, GetSandboxRequest, GetSandboxResponse,
GetCapabilitiesRequest, GetCapabilitiesResponse, GetGatewayListenerRequirementsRequest,
GetGatewayListenerRequirementsResponse, GetSandboxRequest, GetSandboxResponse,
ListSandboxesRequest, ListSandboxesResponse, StopSandboxRequest, StopSandboxResponse,
ValidateSandboxCreateRequest, ValidateSandboxCreateResponse, WatchSandboxesEvent,
WatchSandboxesRequest, compute_driver_server::ComputeDriver,
Expand Down Expand Up @@ -40,6 +41,15 @@ impl ComputeDriver for ComputeDriverService {
.map_err(Status::internal)
}

async fn get_gateway_listener_requirements(
&self,
_request: Request<GetGatewayListenerRequirementsRequest>,
) -> Result<Response<GetGatewayListenerRequirementsResponse>, Status> {
Ok(Response::new(GetGatewayListenerRequirementsResponse {
requirements: Vec::new(),
}))
}

async fn validate_sandbox_create(
&self,
request: Request<ValidateSandboxCreateRequest>,
Expand Down
1 change: 1 addition & 0 deletions crates/openshell-driver-podman/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
thiserror = { workspace = true }
miette = { workspace = true }
url = { workspace = true }

[dev-dependencies]
prost-types = { workspace = true }
Expand Down
Loading
Loading