diff --git a/deploy/docker/Dockerfile.supervisor b/deploy/docker/Dockerfile.supervisor index ef75177c96..44fda684ca 100644 --- a/deploy/docker/Dockerfile.supervisor +++ b/deploy/docker/Dockerfile.supervisor @@ -7,7 +7,7 @@ # deploy/docker/.build/prebuilt-binaries//. # Keep the GNU runtime and CA roots without a shell or unused native TLS libraries. -# The default variant preserves UID 0 and /; compute drivers set the runtime UID. +# Compute drivers override the image's non-root default with the runtime identity. ARG SUPERVISOR_BASE_IMAGE=gcr.io/distroless/base-nossl-debian13@sha256:f21fdfe4ede467d9ea8a6caaec1f8381ea4502243a3e8bb1c43df80c6fbaaeae FROM ${SUPERVISOR_BASE_IMAGE} AS supervisor @@ -15,4 +15,6 @@ ARG TARGETARCH COPY --chmod=0555 deploy/docker/.build/prebuilt-binaries/${TARGETARCH}/openshell-supervisor /openshell-supervisor +USER 65534:65534 + ENTRYPOINT ["/openshell-supervisor"] diff --git a/deploy/helm/openshell/templates/clusterrole.yaml b/deploy/helm/openshell/templates/clusterrole.yaml index 8af91e1901..20a125b5a9 100644 --- a/deploy/helm/openshell/templates/clusterrole.yaml +++ b/deploy/helm/openshell/templates/clusterrole.yaml @@ -139,16 +139,16 @@ rules: - create - get {{- if $managedSshIngressEnabled }} - # Apply gateway-only SSH ingress isolation in managed namespaces. + # Server-side apply needs patch only for the fixed SSH policy name. + # The shared rule above provides get/create for runtime policies. - apiGroups: - networking.k8s.io resources: - networkpolicies + resourceNames: + - openshell-sandbox-ssh verbs: - - get - - create - patch - - update {{- end }} {{- end }} {{- end }} diff --git a/deploy/helm/openshell/tests/clusterrole_test.yaml b/deploy/helm/openshell/tests/clusterrole_test.yaml index 309b10fc0e..afba513dc3 100644 --- a/deploy/helm/openshell/tests/clusterrole_test.yaml +++ b/deploy/helm/openshell/tests/clusterrole_test.yaml @@ -15,7 +15,7 @@ tests: path: metadata.name value: openshell-node-reader-my-namespace - - it: grants managed namespace NetworkPolicy apply permissions + - it: restricts managed SSH policy mutation to its fixed name set: server.drivers.kubernetes.workspaceMode: managed asserts: @@ -24,7 +24,18 @@ tests: content: apiGroups: ["networking.k8s.io"] resources: ["networkpolicies"] - verbs: ["get", "create", "patch", "update"] + resourceNames: ["openshell-sandbox-ssh"] + verbs: ["patch"] + - contains: + path: rules + content: + apiGroups: ["networking.k8s.io"] + resources: ["networkpolicies"] + verbs: ["create", "get"] + - notExists: + path: rules[?(@.resources[0] == "networkpolicies")].verbs[?(@ == "update")] + - notExists: + path: rules[?(@.resources[0] == "networkpolicies" && !@.resourceNames)].verbs[?(@ == "patch")] - it: limits namespaced admission reads to PVCs set: @@ -77,7 +88,8 @@ tests: content: apiGroups: ["networking.k8s.io"] resources: ["networkpolicies"] - verbs: ["get", "create", "patch", "update"] + resourceNames: ["openshell-sandbox-ssh"] + verbs: ["patch"] - it: gives schema-v2 managed SSH ingress precedence over the legacy alias set: @@ -92,7 +104,8 @@ tests: content: apiGroups: ["networking.k8s.io"] resources: ["networkpolicies"] - verbs: ["get", "create", "patch", "update"] + resourceNames: ["openshell-sandbox-ssh"] + verbs: ["patch"] - it: omits credential Secret access in managed mode set: @@ -124,7 +137,7 @@ tests: - name: registry-two asserts: - notExists: - path: rules[*].resourceNames + path: rules[?(@.resources[0] == "secrets")].resourceNames - contains: path: rules content: diff --git a/docs/how-it-works/sandboxes/runtimes.mdx b/docs/how-it-works/sandboxes/runtimes.mdx index 38b594d0b9..21e3fa4871 100644 --- a/docs/how-it-works/sandboxes/runtimes.mdx +++ b/docs/how-it-works/sandboxes/runtimes.mdx @@ -54,6 +54,10 @@ and `SUPERVISOR_BASE_IMAGE` build arguments override their pinned bases. See [Container Image Base Overrides](https://github.com/ai-openshell/openshell/blob/main/CONTRIBUTING.md#container-image-base-overrides) for build commands and base compatibility requirements. +The supervisor image defaults to UID/GID `65534:65534`, including with a custom +base. Compute drivers select the runtime identity explicitly. For direct image +launches, make mounted runtime and log directories writable by the selected user. + For TLS-enabled Docker, Podman, and MicroVM gateways, set `guest_tls_ca` in `[openshell.gateway]` or use the package-managed local CA. Remove the retired `guest_tls_cert` and `guest_tls_key` fields. Supervisors receive only the diff --git a/skills/debug-openshell-cluster/SKILL.md b/skills/debug-openshell-cluster/SKILL.md index b246bb6bce..1ac2e414cb 100644 --- a/skills/debug-openshell-cluster/SKILL.md +++ b/skills/debug-openshell-cluster/SKILL.md @@ -245,7 +245,8 @@ the driver did not supply an immutable image ID; Kubernetes currently omits it. When no image UID is available, `unmapped.container_image` preserves any known workload image reference, including for VM and shared-supervisor records. For custom builds using `SUPERVISOR_BASE_IMAGE`, check the selected base's GNU -runtime libraries, CA certificates, and inherited user and working directory. +runtime libraries, CA certificates, and working directory. The image defaults +to UID/GID `65534:65534`; compute drivers select the runtime identity explicitly. Use container logs, engine inspection and the configured exec health probe for diagnostics; `exec ... sh`, package installation and in-container shell scripts are unavailable. Workload shells belong to the separate sandbox image. Preserve