Introducing a new way to review your PRs.

Read the announcement

replicatedhq / kots

KOTS provides the framework, tools and integrations that enable the delivery and management of 3rd-party Kubernetes applications, a.k.a. Kubernetes Off-The-Shelf (KOTS) Software.

View on GitHub

21 documents · Updated Nov 23, 2026

docs / admin-console-security-state

Admin Console access control and state

The Admin Console protects operator actions through a chain of authentication, session checks, and role-based access control (RBAC). It keeps the trust data for that chain in Kubernetes Secrets, ConfigMaps, and a small persistent store so that access rules survive process restarts and can be revoked when credentials change. See Admin Console service architecture for the parent system view and Admin Console API and request handling for the protected request surface.

Access control model

The access model separates identity proof from permission checks. A login path proves who or what is calling the Admin Console, a session carries the result of that proof, and policy middleware checks whether the session can perform the requested action.

Authentication paths

The Admin Console supports a shared password for local operator access and an external identity service for single sign-on. The KOTS command line uses a separate cluster auth string, so automation does not need a browser session.

The password path checks the shared password before it creates a 12-hour session. The identity-service path starts an OpenID Connect (OIDC) flow, checks the returned identity, and then creates the same kind of Admin Console session. The cluster auth string is checked against the kotsadm-authstring Secret and is converted into a short-lived session for CLI calls. A failure to read the backing Kubernetes service is kept separate from an invalid credential, so an infrastructure error is not treated as proof that the caller supplied bad credentials.

This flow shows how each login path reaches the shared session and API layers.

flowchart LR
    P[Shared password] --> L[Login]
    I[External identity service] --> O[OIDC callback]
    C[KOTS CLI auth string] --> K[CLI token check]
    L --> S[Create Admin Console session]
    O --> S
    K --> S
    S --> J[Signed token]
    J --> M[Session middleware]
    M --> A[Protected API request]

The login mode is selected from identity configuration. Password login is blocked when the identity service is enabled and password authentication is disabled.

References: pkg/…/login.go• L32-47 pkg/…/login.go• L60-146 pkg/…/login.go• L154-195 pkg/…/session.go• L132-156 pkg/…/session.go• L24-79

External identity and group mapping

The identity service connects an external identity provider to Admin Console users. The OIDC callback uses the verified email as the user identity and maps the provider's group claims to configured Admin Console groups.

Each configured group grants one or more role IDs. A user with no matching role cannot enter the Admin Console through OIDC. When no custom groups are configured, the default group grants the cluster-admin role.

References: pkg/…/login.go• L198-240 pkg/…/login.go• L329-379 pkg/…/identity.go• L13-23 pkg/…/session.go• L118-132

Session lifecycle

An Admin Console session is the server-side record behind a signed token. It contains an ID, issue time, expiry time, role IDs, and an RBAC flag. The token carries the session ID; the server loads the session record before it allows a protected request.

Every protected request checks for a Bearer token or the signed-token cookie. The check rejects missing, invalid, expired, or deleted sessions. Active sessions can receive a fresh full timeout after they have been used for at least one hour. A daily purge removes expired records.

The session parser also handles the KOTS CLI token as a separate short-lived session. It validates the token against the kotsadm-authstring Secret and returns a lookup error when the backing cluster service fails, rather than reporting that condition as an invalid token.

The session record also gives password changes a global revocation point. A session issued before the recorded password update time is rejected and removed when it is next used.

References: pkg/…/middleware.go• L80-109 pkg/…/session.go• L50-129 pkg/…/session.go• L24-115 pkg/…/expired_session.go• L10-44

Role-based access control

RBAC is the permission layer after authentication. A session supplies role IDs, while the request policy supplies an action and a resource. The policy engine denies by default and gives a matching deny rule priority over a matching allow rule.

The built-in roles define the main operator profiles:

RoleAccess intent
cluster-adminRead and write access to all resources
supportRead access plus support-bundle and preflight operations, with a file-tree restriction

The API route layer attaches a policy requirement to each protected operation. This keeps a valid login separate from permission to change an application, manage a cluster, or view support data. See Admin Console API and request handling for the wider request path and Admin Console service architecture for the service boundary.

References: pkg/…/rbac.go• L7-52 pkg/…/rego.go• L12-22 pkg/…/rego.go• L69-85 pkg/…/handlers.go• L40-105

Credential and configuration state

Protected operation depends on a small set of shared values. Kubernetes Secrets hold credentials and session material, while a ConfigMap holds identity settings that are safe to expose as configuration. The Admin Console reads these values in its namespace and updates them when an operator changes access settings.

Password state

The shared Admin Console password is stored as a bcrypt hash. The login path compares the supplied password with that hash and records failed attempts so repeated failures can lock the login path until the password is reset.

Password changes require the current password and a new password with at least six characters. The new value must differ from the current value. A successful change writes a new hash and update time, clears failed-attempt state, and invalidates all existing sessions.

The hash normally comes from the kotsadm-password Secret. A configured SHARED_PASSWORD_BCRYPT value provides the fallback when that Secret is absent. This fallback makes the deployment environment part of the password contract.

References: pkg/…/user.go• L13-51 pkg/…/password.go• L20-76 pkg/…/user_store.go• L19-53 pkg/…/password_change.go• L17-84

Secret-backed access values

The Admin Console uses separate Secret-backed values for different trust duties. Keeping them separate lets the system rotate a password without changing the CLI auth string or the token signing key. The kotsadm-session Secret supplies SESSION_KEY to the API process for token signing and checking, while kotsadm-sessions stores the active session records.

StatePurpose
kotsadm-passwordStores the shared password hash and its update time
kotsadm-sessionSupplies the signing key for Admin Console tokens
kotsadm-sessionsStores active session records
kotsadm-authstringAuthenticates KOTS CLI requests and cluster access helpers
kotsadm-dex-stateHolds short-lived OIDC login state used to validate callbacks
kotsadm-identity-secretHolds identity-provider connector data referenced by identity configuration

The deployment marks the password, session, and auth-string values for backup. The runtime still treats each value as a distinct security boundary.

References: pkg/…/namespace.go• L5-12 pkg/…/auth.go• L16-66 pkg/…/session.go• L45-68 pkg/…/session_store.go• L199-240 pkg/…/state.go• L17-27 deploy/…/tmpl-secret-password.yaml• L1-9 deploy/…/tmpl-secret-session.yaml• L1-9 deploy/…/tmpl-secret-authstring.yaml• L1-9

Identity configuration

Identity configuration controls whether the external identity service is active, which Admin Console and identity-service addresses it uses, which groups map to roles, and which provider connectors are available. The system stores the general settings in kotsadm-identity-config and keeps connector data in kotsadm-identity-secret.

The configuration may reference connector data from the Secret instead of placing it in the ConfigMap. API responses mask provider client secrets before they reach the web client. The configuration also defines the network and certificate settings used when the Admin Console talks to the identity service.

References: pkg/…/config.go• L26-75 pkg/…/config.go• L107-185 pkg/…/config.go• L188-239 pkg/…/identity.go• L583-654 pkg/…/http.go• L27-83

OIDC callback state

OIDC state prevents a callback from being accepted unless it matches a login request that the Admin Console started. The system stores the state with a timestamp, checks it during the callback, and removes it after use. Entries older than one day are removed when the state store is updated.

References: pkg/…/login.go• L180-195 pkg/…/login.go• L241-289 pkg/…/state.go• L21-91 pkg/…/state.go• L110-130

Persistent state boundaries

The security state has two persistence patterns. Kubernetes Secrets hold values that must be shared with the running Admin Console and preserved with the installation. The rqlite-backed parameter store holds small named values used by legacy or database-based paths.

Session records are stored as entries in one Kubernetes Secret. The store creates or updates that Secret and briefly caches it to reduce cluster reads. It also migrates older rqlite session records into the Secret. The kotsadm_params table remains a key/value store for database-based login-attempt and password fallback state.

The same persistent store keeps application license data that can affect the state rendered for an application. During a license update, the system carries the incoming license data and active route slug into rendering before it persists the new application and version state. This lets rendering use the new license data before the database update completes and keeps generated air-gap Helm values aligned with the license that triggered the change.

The database also keeps an application's reporting identity across snapshot restore. If no new instance identity exists, the app ID remains the reported identity. Prior identities are kept as lineage so restore detection can track the app across regenerated instances. Unreadable lineage is treated as empty diagnostic data so it does not stop restore detection at startup.

This split matters during backup, restore, migration, and recovery. Restoring the application database without the related Secrets can remove active sessions or leave the Admin Console without the credentials that its configuration expects.

References: pkg/…/session_store.go• L25-29 pkg/…/session_store.go• L39-104 pkg/…/session_store.go• L108-176 pkg/…/license_store.go• L113-213 pkg/…/license_store.go• L237-281 pkg/…/app_store.go• L534-608 migrations/…/kotsadm_params.yaml• L1-23 pkg/…/user_store.go• L56-106

Change checklist

When these files or sections are changed, remember to consider these:

  • Update the login-mode decision, password endpoint guard, and OIDC flow together when identity settings change.
  • Keep role IDs aligned across identity groups, built-in RBAC roles, session creation, and route policy checks.
  • Preserve the shared meaning of SESSION_KEY across token signing and token parsing. A change affects every existing Bearer token.
  • Keep the password update time and session invalidation behavior aligned. A password rotation must not leave old sessions usable.
  • Keep Secret names and keys aligned across runtime reads, deployment templates, backup labels, and migration paths.
  • Treat OIDC state storage and callback validation as one contract. A state format or lifetime change must update both sides.
  • Keep CLI token validation errors distinct from invalid credentials. A change in the auth-string lookup path must preserve the caller's ability to distinguish a cluster lookup failure from a bad token.
  • Keep the raw license payload and active route slug aligned across license sync, application rendering, version creation, and persistence. A change can affect generated air-gap Helm values without breaking the license update itself.
  • Keep the app instance ID fallback and restore lineage aligned with restore detection. Corrupt lineage must remain non-blocking diagnostic state.

Important failure modes

TriggerConsequenceGuard
The password Secret is missing and SHARED_PASSWORD_BCRYPT is empty or invalidPassword login cannot validate the supplied passwordProvide one valid password source before enabling password login
More than ten failed password attempts are recordedThe Admin Console reports a lock and requires a password resetReset the password through the supported CLI or embedded-cluster command
A password is changed but the password update time or session Secret cannot be readRequests can fail during session validation or old sessions can remain in an uncertain stateKeep the password and session Secrets readable and writable by the Admin Console
An OIDC user maps to no configured roleThe callback rejects the login instead of creating a sessionAdd the user to a group with at least one valid role
A callback uses missing, reused, or expired OIDC stateThe identity response is not acceptedStart a new login and keep the state Secret available
The Admin Console cannot read kotsadm-authstringCLI or cluster token requests fail even when the service is runningGrant the caller read access to the Secret in the Admin Console namespace
A session role lacks the route's required policy or matches a deny ruleThe user receives no access to that operationReview the role policy and the route policy as a pair
Session storage or token-key lookup fails during validationThe request cannot be trusted as an authenticated request, and the failure must not be reduced to a bad credentialKeep the session store and SESSION_KEY available and surface lookup failures distinctly
License rendering uses the stored prior license or route slug instead of the incoming values from the current syncGenerated air-gap Helm values can describe the wrong license or route while the update proceedsCarry the incoming license data and active route slug through rendering and version creation before persistence

Key files

FileWhy to read it
pkg/…/login.goShows the password and OIDC entry paths and how they create sessions
pkg/…/session.goDefines request token extraction and session validity checks
pkg/…/middleware.goShows where session checks enter the protected API request path
pkg/…/session.goDefines token parsing, CLI auth-string checks, session signing, and role mapping
pkg/…/rbac.goDefines the built-in Admin Console roles and their access intent
pkg/…/rego.goDefines default-deny behavior and deny-over-allow evaluation
pkg/…/password.goDescribes password rules, hashing, rotation, and session invalidation
pkg/…/user_store.goShows where password hashes, attempt limits, and update time are read and persisted
pkg/…/session_store.goShows the durable boundary for active sessions
pkg/…/license_store.goShows how incoming license data and route state flow through rendering and application version persistence
pkg/…/app_store.goShows the durable app identity and restore-lineage state used during recovery
pkg/…/config.goShows how identity settings and connector secrets are stored and read
pkg/…/state.goShows the OIDC callback state lifetime and cleanup boundary
pkg/…/auth.goDefines the cluster auth-string trust value
migrations/…/kotsadm_params.yamlDefines the small database key/value state used by database-backed paths