Authentication
The OpenShell gateway supports multiple authentication methods organized into two flows: user authentication (CLI to gateway) and sandbox bootstrap (supervisor to gateway).
User authentication
Users authenticate to create, list, and manage sandboxes.
OpenShift SSO (recommended on OpenShift)
The OGO operator deploys an auth-bridge sidecar that translates OpenShift OAuth tokens into standard OIDC JWTs. Users log in with their OpenShift credentials via browser.
openshell gateway login my-cluster
# Browser opens → OpenShift login → JWT stored locally
See OpenShift SSO guide for setup.
External OIDC
On vanilla Kubernetes or when using an external identity provider (Keycloak, Okta, Auth0), configure the gateway's OIDC settings to point at your provider. The CLI handles the OIDC code flow.
mTLS
For CI/CD pipelines and automation, the gateway supports client
certificate authentication. The operator generates a client mTLS
certificate in the {gateway}-client-tls Secret.
oc get secret openshell-client-tls -n ogo -o jsonpath='{.data.tls\.crt}' | base64 -d > client.crt
oc get secret openshell-client-tls -n ogo -o jsonpath='{.data.tls\.key}' | base64 -d > client.key
Sandbox bootstrap
When a sandbox pod starts, the supervisor process inside it must authenticate to the gateway to establish its relay session.
- The pod has a projected Kubernetes ServiceAccount token
(audience:
openshell-gateway, TTL: 1 hour) - The supervisor calls
IssueSandboxTokenwith this SA token - The gateway validates the token via
TokenReview, looks up the pod, verifies theopenshell.io/sandbox-idannotation and the Sandbox CRD ownerReference - The gateway mints a short-lived JWT for the sandbox
- The supervisor uses this JWT for all subsequent calls
This flow is fully automatic - no user interaction required.
Authentication chain
The gateway evaluates authenticators in order:
- K8s ServiceAccount - scoped to
IssueSandboxTokenonly - Sandbox JWT - gateway-minted tokens for sandbox relay
- OIDC - user tokens from auth-bridge or external provider
- mTLS - client certificate identity (when TLS is enabled)
The first authenticator that matches handles the request.
Security considerations
- Tokens are RSA-signed (RS256) JWTs with configurable TTL (default 8h)
- The auth-bridge generates a new signing keypair on every restart, invalidating all existing tokens
- The
adminGroupfield maps an OpenShift group to theopenshell-adminrole for elevated access - Sandbox tokens are scoped to a single sandbox ID and cannot be used to access other sandboxes
See also
- OpenShift SSO guide
- OpenShellGateway CRD -
spec.authfields - Gateway concept - architecture overview