Notice

This document is for a development version of Ceph.

OAuth2 Proxy

Deploying oauth2-proxy

In Ceph releases starting from Tentacle, the oauth2-proxy service introduces an advanced method for managing authentication and access control for Ceph applications. This service integrates with external Identity Providers (IDPs) to provide secure, flexible authentication via the OIDC (OpenID Connect) protocol. oauth2-proxy acts as an authentication gateway, ensuring that access to Ceph applications including the Ceph Dashboard and monitoring stack is tightly controlled.

To deploy the oauth2-proxy service, use the following command:

ceph orch apply oauth2-proxy [--placement ...] ...

Once applied, cephadm will re-configure the necessary components to use oauth2-proxy for authentication, thereby securing access to Ceph applications through the mgmt-gateway. The service will handle login flows, redirect users to the appropriate IDP for authentication, and manage session tokens to facilitate seamless user access.

Benefits of the oauth2-proxy service

  • Enhanced Security: Provides robust authentication through integration with external IDPs using the OIDC protocol.

  • Seamless SSO: Enables seamless single sign-on (SSO) across all Ceph applications, improving user access control.

  • Centralized Authentication: Centralizes authentication management, reducing complexity and improving control over access.

Security enhancements

With the oauth2-proxy service, the mgmt-gateway requires a login with the identity provider before it passes requests to the Ceph Dashboard, Prometheus, Alertmanager or Grafana. This covers access through the gateway only. Grafana can still be reached directly on its own port, and it allows anonymous read-only access there unless anonymous_access is false in the Grafana specification. Because it uses the oauth2-proxy open source project, this service integrates easily with a variety of external IDPs.

High availability

In general, oauth2-proxy is used in conjunction with the mgmt-gateway. The oauth2-proxy service can be deployed as multiple stateless instances, with the mgmt-gateway (NGINX reverse-proxy) handling load balancing across these instances using a round-robin strategy. Since oauth2-proxy integrates with an external identity provider (IDP), ensuring high availability for login is managed externally and not the responsibility of this service.

Accessing services with oauth2-proxy

After deploying oauth2-proxy, access to Ceph applications through the mgmt-gateway requires a login with the configured IDP. Users will be redirected to the IDP for login and then returned to the requested application. This setup ensures secure access and integrates seamlessly with the Ceph management stack.

Service Specification

The oauth2-proxy service works together with the mgmt-gateway service. If mgmt-gateway is not deployed yet, deploy it first (see Management Gateway):

ceph orch apply mgmt-gateway

If mgmt-gateway is already deployed, skip this step. The command replaces the existing mgmt-gateway specification, including its placement, port, virtual IP and certificate settings, with the defaults.

Cephadm adds the single sign-on checks to the gateway configuration when an oauth2-proxy daemon exists.

An oauth2-proxy service can be applied using a specification. An example in YAML follows:

service_type: oauth2-proxy
placement:
  label: mgmt
spec:
 https_address: "0.0.0.0:4180"
 provider_display_name: "My OIDC Provider"
 client_id: "your-client-id"
 oidc_issuer_url: "http://192.168.100.1:5556/dex"
 client_secret: "your-client-secret"
 ssl_cert: |
   -----BEGIN CERTIFICATE-----
   MIIDtTCCAp2gAwIBAgIYMC4xNzc1NDQxNjEzMzc2MjMyXzxvQ7EcMA0GCSqGSIb3
   DQEBCwUAMG0xCzAJBgNVBAYTAlVTMQ0wCwYDVQQIDARVdGFoMRcwFQYDVQQHDA5T
   [...]
   -----END CERTIFICATE-----
 ssl_key: |
   -----BEGIN PRIVATE KEY-----
   MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC5jdYbjtNTAKW4
   /CwQr/7wOiLGzVxChn3mmCIF3DwbL/qvTFTX2d8bDf6LjGwLYloXHscRfxszX/4h
   [...]
   -----END PRIVATE KEY-----

cookie_secret is optional. If you leave it out, cephadm generates one. If you set it, use the URL-safe base64 encoding of 16, 24, or 32 random bytes.

Fields specific to the spec section of the oauth2-proxy service are described below. More detailed description of the fields can be found on oauth2-proxy project documentation.

class ceph.deployment.service_spec.OAuth2ProxySpec(service_type='oauth2-proxy', service_id=None, config=None, networks=None, placement=None, https_address=None, provider_display_name=None, client_id=None, client_secret=None, oidc_issuer_url=None, redirect_url=None, scope=None, cookie_secret=None, ssl_cert=None, ssl_key=None, ssl=True, certificate_source=None, custom_sans=None, email_domains=None, allowlist_domains=None, ssl_insecure_skip_verify=False, unmanaged=False, extra_container_args=None, extra_entrypoint_args=None, custom_configs=None)
client_id

The client ID for authenticating with the identity provider.

client_secret

The client secret for authenticating with the identity provider.

email_domains

List of allowed email domains.

https_address

The address for HTTPS connections, formatted as ‘host:port’.

oidc_issuer_url

The URL of the OpenID Connect (OIDC) issuer.

provider_display_name

The display name for the identity provider (IDP) in the UI.

ssl_insecure_skip_verify

Skip TLS verification for the OIDC provider. Use only in non-production environments.

Apply the specification with the following command:

ceph orch apply -i oauth2-proxy.yaml

Limitations

A non-exhaustive list of important limitations for the oauth2-proxy service follows:

  • Proper configuration of the IDP and OAuth2 parameters is crucial to avoid authentication failures. Misconfigurations can lead to access issues.

  • IDP must include the jti claim in the issued JWT token because the Ceph Dashboard relies on this value to verify the token’s validity.

  • When cephadm removes an oauth2-proxy daemon, or fails to deploy one, and no other oauth2-proxy daemon is running, cephadm disables OAuth2 SSO in the Ceph Dashboard. Cephadm does not turn it on again. When an oauth2-proxy daemon is running again, run ceph dashboard sso enable oauth2. The command is refused while no oauth2-proxy daemon is running. See Enabling OAuth2 Single Sign-On (SSO).

Container images

The container image the oauth2-proxy service will use can be found by running:

ceph config get mgr mgr/cephadm/container_image_oauth2_proxy

Admins can specify a custom image to be used by changing the container_image_oauth2_proxy cephadm module option. If there were already running daemon(s), you must also redeploy the daemon(s) for them to use the new image.

For example:

ceph config set mgr mgr/cephadm/container_image_oauth2_proxy <new-oauth2-proxy-image>
ceph orch redeploy oauth2-proxy

Brought to you by the Ceph Foundation

The Ceph Documentation is a community resource funded and hosted by the non-profit Ceph Foundation. If you would like to support this and our other efforts, please consider joining now.