Skip to content

Commit 775249e

Browse files
authored
Wire OpenShell driver_config for corporate CA trust bundles (#337)
* Wire OpenShell driver_config for corporate CA trust bundles. Mount operator PVC cert bundles at sandbox create time and set standard trust env vars so internal HTTPS works without image rebuilds. * Fix beta Docker builds to precompile Linux binaries. astonish and sandbox-openshell images COPY astonish-linux-${TARGETARCH}; align beta-release with docker-images.yml so those files exist in context. * Bump OpenShell to 0.0.86 and add Helm cert-bundle bootstrap. PVC volume_mounts in driver_config need OpenShell >= 0.0.81; chart-managed bootstrap Jobs populate optional trust-bundle PVCs for certBundles.
1 parent fb287fc commit 775249e

21 files changed

Lines changed: 856 additions & 38 deletions

‎.github/workflows/beta-release.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,25 @@ jobs:
195195
npm ci
196196
npm run build
197197
198+
# Dockerfile COPYs pre-built astonish-linux-${TARGETARCH}; compile on the
199+
# runner (same as docker-images.yml) to avoid QEMU Go builds.
200+
- name: Set up Go
201+
uses: actions/setup-go@v6
202+
with:
203+
go-version-file: 'go.mod'
204+
205+
- name: Cross-compile Linux binaries
206+
env:
207+
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }}
208+
run: |
209+
touch web/embed.go
210+
LDFLAGS="-s -w -X github.com/SAP/astonish/cmd/astonish.Version=${VERSION_TAG}"
211+
echo "Building linux/amd64..."
212+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$LDFLAGS" -o astonish-linux-amd64 .
213+
echo "Building linux/arm64..."
214+
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="$LDFLAGS" -o astonish-linux-arm64 .
215+
ls -la astonish-linux-*
216+
198217
- name: Set up QEMU
199218
uses: docker/setup-qemu-action@v4
200219

@@ -418,6 +437,23 @@ jobs:
418437
npm ci
419438
npm run build
420439
440+
# Dockerfile COPYs astonish-linux-${TARGETARCH}; compile on the runner
441+
# (same as docker-images.yml build-sandbox-openshell).
442+
- name: Set up Go
443+
uses: actions/setup-go@v6
444+
with:
445+
go-version-file: 'go.mod'
446+
447+
- name: Cross-compile Linux binaries
448+
env:
449+
VERSION_TAG: ${{ needs.prepare.outputs.version_tag }}
450+
run: |
451+
touch web/embed.go
452+
LDFLAGS="-s -w -X github.com/SAP/astonish/cmd/astonish.Version=${VERSION_TAG}"
453+
echo "Building linux/amd64..."
454+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="$LDFLAGS" -o astonish-linux-amd64 .
455+
ls -la astonish-linux-*
456+
421457
- name: Set up Docker Buildx
422458
uses: docker/setup-buildx-action@v4
423459

‎deploy/helm/astonish/Chart.lock‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
- name: helm-chart
33
repository: oci://ghcr.io/nvidia/openshell
4-
version: 0.0.63
5-
digest: sha256:809060cc93e6a529ece1831f78bf228bc51aad8715e76fc7159e15a59c9614cd
6-
generated: "2026-06-16T20:08:55.379128684-04:00"
4+
version: 0.0.86
5+
digest: sha256:298c34e2d6d116f4d7e9433fd113a63159beff64f87e6e519ccb1dbf031ff618
6+
generated: "2026-07-19T18:06:33.004657-04:00"

‎deploy/helm/astonish/Chart.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ maintainers:
2121
dependencies:
2222
- name: helm-chart
2323
alias: openshell
24-
# TODO: Upgrade to 0.0.70 for Landlock ABI v5 PTY fix on kernel 6.10+.
24+
# 0.0.86: PVC mounts via driver_config (≥0.0.81) + Landlock ABI v5 PTY (≥0.0.70).
2525
# Run `helm dependency update` after bumping.
26-
version: "0.0.63"
26+
version: "0.0.86"
2727
repository: "oci://ghcr.io/nvidia/openshell"
2828
condition: sandbox.openshell.enabled

‎deploy/helm/astonish/templates/configmap.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ data:
127127
{{- end }}
128128
{{- end }}
129129
{{- end }}
130+
{{- with .Values.sandbox.openshell.certBundles }}
131+
cert_bundles:
132+
{{- range . }}
133+
- name: {{ .name | quote }}
134+
claim_name: {{ .claimName | quote }}
135+
mount_path: {{ .mountPath | quote }}
136+
{{- if .subPath }}
137+
sub_path: {{ .subPath | quote }}
138+
{{- end }}
139+
{{- with .trustEnv }}
140+
trust_env:
141+
{{- range . }}
142+
- {{ . | quote }}
143+
{{- end }}
144+
{{- end }}
145+
{{- end }}
146+
{{- end }}
130147
{{- if .Values.sandbox.openshell.idleTimeoutMinutes }}
131148
idle_timeout_minutes: {{ .Values.sandbox.openshell.idleTimeoutMinutes }}
132149
{{- end }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{{- if and .Values.sandbox.enabled .Values.sandbox.openshell.enabled .Values.sandbox.openshell.certBundles }}
2+
{{- range $i, $bundle := .Values.sandbox.openshell.certBundles }}
3+
{{- if and $bundle.bootstrap $bundle.bootstrap.enabled $bundle.bootstrap.url $bundle.claimName }}
4+
{{- $subPath := default "ca-bundle.crt" $bundle.subPath }}
5+
{{- $image := default "debian:bookworm-slim" $bundle.bootstrap.image }}
6+
---
7+
# One-shot Helm hook: download a corporate CA and write a combined PEM
8+
# (system CAs + downloaded cert) onto the cert-bundle PVC.
9+
#
10+
# hook-delete-policy matches sandbox seed-job: replace on each upgrade,
11+
# clean up after success.
12+
apiVersion: batch/v1
13+
kind: Job
14+
metadata:
15+
name: {{ include "astonish.fullname" $ }}-cert-bundle-{{ $bundle.name }}
16+
namespace: {{ include "astonish.namespace.sandbox" $ }}
17+
labels:
18+
{{- include "astonish.labels" $ | nindent 4 }}
19+
app.kubernetes.io/component: cert-bundle-bootstrap
20+
astonish.io/cert-bundle: {{ $bundle.name | quote }}
21+
annotations:
22+
"helm.sh/hook": post-install,post-upgrade
23+
"helm.sh/hook-weight": "10"
24+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
25+
spec:
26+
completions: 1
27+
parallelism: 1
28+
backoffLimit: 3
29+
template:
30+
metadata:
31+
labels:
32+
{{- include "astonish.labels" $ | nindent 8 }}
33+
app.kubernetes.io/component: cert-bundle-bootstrap
34+
astonish.io/cert-bundle: {{ $bundle.name | quote }}
35+
spec:
36+
restartPolicy: OnFailure
37+
containers:
38+
- name: bootstrap
39+
image: {{ $image | quote }}
40+
imagePullPolicy: IfNotPresent
41+
command: ["/bin/sh", "-c"]
42+
args:
43+
- |
44+
set -eu
45+
export DEBIAN_FRONTEND=noninteractive
46+
apt-get update
47+
apt-get install -y --no-install-recommends ca-certificates curl
48+
DEST="/bundle/{{ $subPath }}"
49+
echo "astonish-cert-bundle: downloading CA from configured URL"
50+
curl -fsSL -o /tmp/org-ca.crt "{{ $bundle.bootstrap.url }}"
51+
# Combined bundle: system trust store + org CA (SSL_CERT_FILE replaces
52+
# the system store — a corp-only PEM would break public HTTPS).
53+
cat /etc/ssl/certs/ca-certificates.crt /tmp/org-ca.crt > "$DEST"
54+
chmod 644 "$DEST"
55+
echo "astonish-cert-bundle: wrote $DEST ($(wc -c < "$DEST") bytes)"
56+
volumeMounts:
57+
- name: bundle
58+
mountPath: /bundle
59+
resources:
60+
requests:
61+
cpu: 50m
62+
memory: 64Mi
63+
limits:
64+
cpu: 500m
65+
memory: 256Mi
66+
volumes:
67+
- name: bundle
68+
persistentVolumeClaim:
69+
claimName: {{ $bundle.claimName | quote }}
70+
{{- end }}
71+
{{- end }}
72+
{{- end }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- if and .Values.sandbox.enabled .Values.sandbox.openshell.enabled .Values.sandbox.openshell.certBundles }}
2+
{{- range .Values.sandbox.openshell.certBundles }}
3+
{{- if and .bootstrap .bootstrap.enabled .claimName }}
4+
---
5+
# Cert-bundle PVC for OpenShell sandbox trust mounts (driver_config).
6+
# Populated by the matching cert-bundle-bootstrap Job when bootstrap.enabled.
7+
apiVersion: v1
8+
kind: PersistentVolumeClaim
9+
metadata:
10+
name: {{ .claimName | quote }}
11+
namespace: {{ include "astonish.namespace.sandbox" $ }}
12+
labels:
13+
{{- include "astonish.labels" $ | nindent 4 }}
14+
app.kubernetes.io/component: cert-bundle
15+
astonish.io/cert-bundle: {{ .name | quote }}
16+
spec:
17+
accessModes:
18+
- ReadWriteOnce
19+
storageClassName: {{ default $.Values.sandbox.storage.storageClassName .bootstrap.storageClassName | quote }}
20+
resources:
21+
requests:
22+
storage: {{ default "64Mi" .bootstrap.size | quote }}
23+
{{- end }}
24+
{{- end }}
25+
{{- end }}

‎deploy/helm/astonish/values.yaml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,35 @@ sandbox:
328328
# - /mnt/scratch
329329
# - /dev/fuse
330330

331+
# Corporate CA / trust bundles mounted into every sandbox via OpenShell
332+
# driver_config (Kubernetes PVC mounts). Empty = no mounts (default).
333+
# Each entry's PVC holds a *combined* PEM (system CAs + corporate roots).
334+
# Mount paths must not be under /sandbox or /etc/openshell{,-tls}.
335+
# Trust env vars default to SSL_CERT_FILE, CURL_CA_BUNDLE,
336+
# REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS, GIT_SSL_CAINFO.
337+
#
338+
# Optional per-entry bootstrap: chart creates the PVC and a post-install
339+
# Job that downloads bootstrap.url, appends it to the system CA bundle,
340+
# and writes subPath (default ca-bundle.crt) onto the PVC. Orgs can also
341+
# pre-provision the PVC and omit bootstrap.
342+
#
343+
# NOTE: RWO PVCs can only attach to one node. Prefer RWX/ROX when sandboxes
344+
# schedule across multiple nodes, or pin sandboxes to a single node.
345+
certBundles: []
346+
# Example (chart-managed bootstrap):
347+
# certBundles:
348+
# - name: corp-root-ca
349+
# claimName: astonish-corp-ca
350+
# mountPath: /etc/astonish-ca/ca-bundle.crt
351+
# subPath: ca-bundle.crt
352+
# # trustEnv: [] # use defaults, or override
353+
# bootstrap:
354+
# enabled: true
355+
# url: "https://pki.example.com/corp-root-ca.crt"
356+
# size: 64Mi
357+
# storageClassName: "" # empty = sandbox.storage.storageClassName
358+
# image: "debian:bookworm-slim"
359+
331360
# Idle timeout (minutes) before the watchdog evicts an unused sandbox pod.
332361
# 0 = disable idle eviction (pods run indefinitely).
333362
# Evicted sessions are transparently recreated on next tool call (~5-10s).

‎docs/architecture/openshell-sandbox-backend.md‎

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ graph TB
6969

7070
| Component | Image / Artifact | Purpose |
7171
|-----------|-----------------|---------|
72-
| **Gateway** | `ghcr.io/nvidia/openshell/gateway:0.0.63` | Sandbox lifecycle, exec relay, policy distribution |
73-
| **Supervisor** | `ghcr.io/nvidia/openshell/supervisor:0.0.63` | PID 1 inside sandboxes, Landlock/seccomp enforcement (≥0.0.70 recommended for kernel 6.10+ PTY fix) |
74-
| **Helm Chart** | `oci://ghcr.io/nvidia/openshell/helm-chart:0.0.63` | Deploys gateway + RBAC (subchart of Astonish) |
72+
| **Gateway** | `ghcr.io/nvidia/openshell/gateway:0.0.86` | Sandbox lifecycle, exec relay, policy distribution |
73+
| **Supervisor** | `ghcr.io/nvidia/openshell/supervisor:0.0.86` | PID 1 inside sandboxes, Landlock/seccomp enforcement |
74+
| **Helm Chart** | `oci://ghcr.io/nvidia/openshell/helm-chart:0.0.86` | Deploys gateway + RBAC (subchart of Astonish); ≥0.0.81 required for cert-bundle PVC mounts via `driver_config` |
7575

7676
#### Astonish Provides
7777

@@ -509,13 +509,14 @@ openshell:
509509

510510
```go
511511
type SandboxOpenShellConfig struct {
512-
GatewayAddr string `yaml:"gateway_addr" json:"gateway_addr"`
513-
GatewayTLS bool `yaml:"gateway_tls" json:"gateway_tls"`
514-
ClientCertPath string `yaml:"client_cert_path,omitempty" json:"client_cert_path,omitempty"`
515-
ClientKeyPath string `yaml:"client_key_path,omitempty" json:"client_key_path,omitempty"`
516-
CACertPath string `yaml:"ca_cert_path,omitempty" json:"ca_cert_path,omitempty"`
517-
AuthToken string `yaml:"auth_token,omitempty" json:"auth_token,omitempty"`
518-
SandboxImage string `yaml:"sandbox_image,omitempty" json:"sandbox_image,omitempty"`
512+
GatewayAddr string `yaml:"gateway_addr" json:"gateway_addr"`
513+
GatewayTLS bool `yaml:"gateway_tls" json:"gateway_tls"`
514+
ClientCertPath string `yaml:"client_cert_path,omitempty"`
515+
ClientKeyPath string `yaml:"client_key_path,omitempty"`
516+
CACertPath string `yaml:"ca_cert_path,omitempty"`
517+
AuthToken string `yaml:"auth_token,omitempty"`
518+
SandboxImage string `yaml:"sandbox_image,omitempty"`
519+
CertBundles []CertBundleConfig `yaml:"cert_bundles,omitempty"` // PVC mounts via driver_config
519520
}
520521
```
521522

@@ -624,17 +625,21 @@ type FilesystemSpec struct {
624625
}
625626

626627
type CreateSandboxRequest struct {
627-
Name string
628-
Image string
629-
Env map[string]string
630-
Labels map[string]string
631-
Policy *SandboxPolicySpec
628+
Name string
629+
Image string
630+
Env map[string]string
631+
Labels map[string]string
632+
Policy *SandboxPolicySpec
633+
DriverConfig map[string]any // OpenShell driver-keyed envelope
632634
}
633635
```
634636

635637
The `mapPolicyToProto()` helper in `client_grpc.go` converts these
636638
domain types to the protobuf `SandboxPolicy` message before sending
637-
to the gateway.
639+
to the gateway. When `DriverConfig` is set, it is encoded as
640+
`SandboxTemplate.driver_config` (`google.protobuf.Struct`). Platform
641+
`cert_bundles` config renders into the Kubernetes driver's PVC mount
642+
schema and trust env vars — see `pkg/sandbox/openshell/driver_config.go`.
638643

639644
---
640645

@@ -647,6 +652,7 @@ to the gateway.
647652
| `pkg/sandbox/openshell/exec.go` | Exec with `wrapCommand()` for WorkDir/Env |
648653
| `pkg/sandbox/openshell/fleet.go` | Fleet/pool management, CreateSandbox with policy |
649654
| `pkg/sandbox/openshell/policy.go` | `defaultSandboxPolicy()` — Landlock filesystem rules |
655+
| `pkg/sandbox/openshell/driver_config.go` | CertBundles → K8s `driver_config` PVC mounts + trust env |
650656
| `pkg/sandbox/openshell/gateway_client.go` | GatewayClient interface, domain types (SandboxPolicySpec, etc.) |
651657
| `pkg/sandbox/openshell/client_grpc.go` | Real gRPC implementation, `mapPolicyToProto()` |
652658
| `pkg/sandbox/openshell/client_grpc_test.go` | Policy mapping tests |

‎docs/website/docs/deployment/openshell.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,48 @@ sandbox:
428428
- /mnt/scratch
429429
```
430430

431+
### Corporate CA / Trust Bundles (`driver_config`)
432+
433+
Requires the OpenShell gateway **≥ 0.0.81** (Astonish chart pins **0.0.86**).
434+
Older gateways reject `containers.agent.volume_mounts` in `driver_config`.
435+
436+
To trust internal HTTPS endpoints without rebuilding the sandbox image,
437+
mount a combined CA bundle (system CAs + corporate roots) via OpenShell
438+
`driver_config` PVC mounts. Configure only through Helm values — leave
439+
`certBundles` empty (default) for no mounts.
440+
441+
**Chart-managed bootstrap** (recommended): Helm creates the PVC and a
442+
post-install/upgrade Job that downloads your org CA URL, appends it to
443+
the Debian system trust store, and writes the combined PEM onto the PVC.
444+
445+
```yaml
446+
sandbox:
447+
openshell:
448+
certBundles:
449+
- name: corp-root-ca
450+
claimName: astonish-corp-ca
451+
mountPath: /etc/astonish-ca/ca-bundle.crt
452+
subPath: ca-bundle.crt
453+
bootstrap:
454+
enabled: true
455+
url: "https://pki.example.com/corp-root-ca.crt"
456+
```
457+
458+
Or pre-provision the PVC yourself and omit `bootstrap`.
459+
460+
Astonish mounts the PVC read-only into every sandbox, sets trust env vars
461+
(`SSL_CERT_FILE`, `CURL_CA_BUNDLE`, `REQUESTS_CA_BUNDLE`,
462+
`NODE_EXTRA_CA_CERTS`, `GIT_SSL_CAINFO`) to the mount path, and adds the
463+
path to the Landlock read-only set.
464+
465+
Mount paths must not be under `/sandbox` (workspace) or
466+
`/etc/openshell` / `/etc/openshell-tls` (OpenShell-managed). Use a
467+
*combined* bundle — `SSL_CERT_FILE` replaces the system store, so a
468+
corp-only PEM would break public HTTPS.
469+
470+
On RWO StorageClasses (e.g. Cinder), the cert PVC can attach to only one
471+
node; use RWX/ROX or pin sandboxes when scheduling across multiple nodes.
472+
431473
**Landlock enforcement mode:**
432474

433475
```yaml

‎pkg/config/app_config.go‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,42 @@ type SandboxOpenShellConfig struct {
137137
// nodes or operator-specific mount points without modifying code.
138138
FilesystemPolicy FilesystemPolicyConfig `yaml:"filesystem_policy,omitempty" json:"filesystem_policy,omitempty"`
139139

140+
// CertBundles mounts operator-provided CA trust material into every
141+
// OpenShell sandbox via driver_config PVC mounts, and sets standard
142+
// trust env vars (SSL_CERT_FILE, etc.) to the mounted bundle path.
143+
// Each bundle must already exist as a PVC in the sandbox namespace and
144+
// should contain a combined PEM (system CAs + corporate roots).
145+
CertBundles []CertBundleConfig `yaml:"cert_bundles,omitempty" json:"cert_bundles,omitempty"`
146+
140147
// IdleTimeoutMinutes evicts sandbox pods that have had no exec activity
141148
// for this duration. The pod is deleted (state → evicted) and recreated
142149
// transparently on the next tool call. Default: 240 (4 hours). Set to
143150
// -1 to disable idle eviction entirely.
144151
IdleTimeoutMinutes *int `yaml:"idle_timeout_minutes,omitempty" json:"idle_timeout_minutes,omitempty"`
145152
}
146153

154+
// CertBundleConfig describes a read-only CA bundle mounted into OpenShell
155+
// sandboxes via the Kubernetes driver's driver_config PVC mount schema.
156+
type CertBundleConfig struct {
157+
// Name is the Kubernetes volume name (DNS-1123 label), e.g. "corp-root-ca".
158+
Name string `yaml:"name" json:"name"`
159+
160+
// ClaimName is the existing PVC name in the sandbox namespace.
161+
ClaimName string `yaml:"claim_name" json:"claim_name"`
162+
163+
// MountPath is the absolute path inside the sandbox where the bundle
164+
// is mounted, e.g. "/etc/astonish-ca/ca-bundle.crt".
165+
MountPath string `yaml:"mount_path" json:"mount_path"`
166+
167+
// SubPath is an optional PVC subpath (relative file within the claim).
168+
SubPath string `yaml:"sub_path,omitempty" json:"sub_path,omitempty"`
169+
170+
// TrustEnv lists env var names set to MountPath. When empty, defaults to
171+
// SSL_CERT_FILE, CURL_CA_BUNDLE, REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS,
172+
// and GIT_SSL_CAINFO.
173+
TrustEnv []string `yaml:"trust_env,omitempty" json:"trust_env,omitempty"`
174+
}
175+
147176
// RegistryConfig holds OCI registry connection details for pushing
148177
// custom-built sandbox images.
149178
type RegistryConfig struct {

0 commit comments

Comments
 (0)