Integrating Ceph RADOS Gateway with STS, OpenID Connect and INDIGO IAM

Oct 25, 2026

In this post, I explore how to configure STS for Ceph RADOS Gateway S3 with INDIGO IAM as an OpenID Connect provider.

Some context

RADOS Gateway implements a subset of AWS Security Token Service (STS) APIs since the Nautilus release. STS allows applications and services to get ephemeral access to S3 resources, by issuing temporary credentials: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN. Access to the resources can be further controlled through the use of AWS S3 bucket policies which are natively supported by RADOS Gateway.

This mechanism is especially interesting when users want to delegate access to their S3 resources to a third party service or application, with fine grained control over what operations can be done and with support for federated access when using OpenID Connect.

Enabling STS in RADOS Gateway

Configuring rgw_sts_key

We are going to begin by generating a 16 characters hexadecimal string that will be used to encrypt and decrypt the session tokens contained in AWS_SESSION_TOKEN.

$ openssl rand -hex 8
c7f4de5b357db789
$ ceph config set client.{RGW_SERVICE_NAME} rgw_sts_key c7f4de5b357db789

RGW_SERVICE_NAME is the name of the RADOS Gateway service, i.e. rgw.mesocentre.uca-lab-oscar in the following output.

$ ceph orch ls
NAME                          PORTS        RUNNING  REFRESHED  AGE  PLACEMENT
alertmanager                  ?:9093,9094      1/1  114s ago   2w   count:1
crash                                          1/1  114s ago   2w   *
grafana                       ?:3000           1/1  114s ago   2w   count:1
mgr                                            2/2  114s ago   2w   count:2
mon                                            1/5  114s ago   2w   count:5
node-exporter                 ?:9100           1/1  114s ago   2w   *
osd.all-available-devices                        3  114s ago   2w   *
prometheus                    ?:9095           1/1  114s ago   2w   count:1
rgw.mesocentre.uca-lab-oscar  ?:7480           1/1  114s ago   2w   count:1     

Since the Squid release, this key should be generated using ceph-authtool --gen-print-key.

Configuring rgw_s3_auth_use_sts

This flag is used to enable STS on the RADOS Gateway S3 endpoint.

$ ceph config set client.{RGW_SERVICE_NAME} rgw_s3_auth_use_sts true

Checking the configuration

You should now have something similar to this in your Ceph configuration:

$ ceph config get client.{RGW_SERVICE_NAME}
WHO                        MASK  LEVEL     OPTION               VALUE             RO
...
client.{RGW_SERVICE_NAME}        advanced  rgw_s3_auth_use_sts  true
client.{RGW_SERVICE_NAME}        advanced  rgw_sts_key          c7f4de5b357db789  *
...

Configuring INDIGO IAM OpenID Connect to work with RADOS Gateway STS

RADOS Gateway implements the following STS APIs:

  • AssumeRole which allows you to get ephemeral S3 access tokens provided you have existing an existing AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  • AssumeRoleWithWebIdentity which allows you to get ephemeral S3 access tokens from an OpenID Connect ID Token.

See STS in Ceph for more details.

The GetCallerIdentity API is also implemented since the Umbrella release.

The AssumeRoleWithWebIdentity API

Here is an overview of how it works:


sequenceDiagram
    autonumber
    actor User as User
    participant App as Application or Service
    participant IAM as INDIGO IAM
    participant RGW as RADOS Gateway

    User->>App: Wants to access S3 Resources
    App->>User: Redirects to IAM
    User->>IAM: Authorizes App
    IAM->>App: Returns auth. code 
    App<<->>IAM: Exhanges auth. code for user {ID Token}
    App->>RGW: Calls STS AssumeRoleWithWebIdentity API 
{Role, ID Token, Duration} RGW->>IAM: Validates {ID Token} RGW->>App: Returns
{AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN} App->>RGW: Accesses S3 APIs with
{AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN}

RADOS Gateway STS engine validates the token against the JSON Web Key Sets (JWKS). To do this the STS engine accesses the JWKS URI, which is specified in the jwks_uri field of the OpenID Connect discovery documents of your Authorization Server at https://{Authorization Server}/.well-known/openid-configuration. In the JWKS the STS engine specifically looks for the x5c field. As per RFC7517, this optional field should contain a base64-encoded DER certificate which will be used for token verification.

INDIGO IAM JWKS x5c field

If you have followed the INDIGO IAM documentation to generate you JWKS, it won't include the x5c field. Luckily, we can generate a certificate for it using the existing information present in the JWKS as it includes everything we need to generate a public and a private key, which we will use to generate a certificate.

If you already have and INDIGO IAM deployment in production, I strongly advise you against generating a new JWKS using a tool which produces the x5c field. It will most likely break your deployment and prevent users from authenticating.

We are going to proceed as follows:

  1. Locate the current JWKS on the INDIGO IAM server, it is usually named keystore.jwks

You probably want to back it up before, i.e. $ cp keystore.jwks keystore.jwks.backup, as we will edit it later on.

  1. Use this script, which I have slighty modified to accommodate INDIGO IAM JWKS structure.
  2. You now have the keys corresponding to your JWKS: rsa_private.pem and rsa_public.pem
  3. Use the private key to to generate a self-signed certificate which will expire in the duration of your choice. For example 3650 days or ~10 years. You may also include a subject to your certificate although it is optional:
$ openssl req -x509 -new -key rsa_private.pem -sha256 -days 3650 -out certificate.pem -subj "/CN=iam-uca-mesocentre"
  1. Encode the certificate to base64 for the x5c field:
$ openssl x509 -in certificate.pem -outform DER | basenc --base64 | tr -d '\n'
MIIDGzCCAgOgAwIBAgIUBUMtm5GP...==
  1. Edit keystore.jwks and add the certificate to the x5c field. Note that this field contains an array.
{
    "keys": [
        {
            "p": "...",
            "kty": "RSA",
            "q": "...",
            "d": "...",
            "e": "AQAB",
            "kid": "....",
            "qi": "...",
            "dp": "...",
            "dq": "...",
            "n": "...",
            "x5c": ["MIIDGzCCAgOgAwIBAgIUBUMtm5GP...=="]
        }
    ]
}

INDIGO IAM JWKS x5t field

We are also going to generate the x5t field. As per RFC7517, this optional field should contain the base64-url encoded SHA-1 thumbprint for the certificate we have put in the x5c field. We will also use the unencoded version of the SHA-1 thumbprint when creating the OpenID Connect provider in RADOS Gateway.

  1. Get the thumbprint
$ openssl x509 -in certificate.pem -fingerprint -sha1 -noout | cut -d '=' -f2 | tr -d ':'
CF6CD9212F24FE6A98C697A0BBCD83861C80FCDC

Save it for later! We'll use it when configuring the OpenID Connect provider in RADOS Gateway.

  1. Encode it to base64-url. This is the value for the x5t field.
$ echo -n "CF6CD9212F24FE6A98C697A0BBCD83861C80FCDC" | basenc --base64url
Q0Y2Q0Q5MjEyRjI0RkU2QTk4QzY5N0EwQkJDRDgzODYxQzgwRkNEQw==

After editing the JWKS and adding the thumbprint, it should look like this:

{
    "keys": [
        {
            "p": "...",
            "kty": "RSA",
            "q": "...",
            "d": "...",
            "e": "AQAB",
            "kid": "....",
            "qi": "...",
            "dp": "...",
            "dq": "...",
            "n": "...",
            "x5c": ["MIIDGzCCAgOgAwIBAgIUBUMtm5GP...=="],
            "x5t": "Q0Y2Q0Q5MjEyRjI0RkU2QTk4QzY5N0EwQkJDRDgzODYxQzgwRkNEQw=="
        }
    ]
}

Testing STS

Now that STS is configured and that RADOS Gateway will be able to validate INDIGO IAM OpenID Connect tokens, we will test the AssumeRoleWithWebIdentity API. We will do this using dummy scripts posing as an application wanting to access S3 resources on behalf of a user.

Setting up an OpenID Connect client in INDIGO IAM

Please refer to the Registering a client page in the INDIGO IAM documentation for more details.

Create a client with the following specifications:

  • Main → Redirect URIs: Ensure it is set to something like http://localhost:4242/cb.
  • Scopes → System scopes: Ensure openid, profile and email are checked.
  • Grant types → Grant types: Ensure authorization_code is checked as we will use the authorization code flow to get an OpenID Connect token.

You will get a client ID and a client secret, which I will respectively call CLIENT_ID and CLIENT_SECRET.

Registering the OpenID Connect provider in RADOS Gateway

  1. Ensure you have a RADOS Gateway user with the oidc-provider=* capabilities. If not, you can create one like this:
$ radosgw-admin --uid oidc-admin --display-name "OIDC Admin" --access_key oidc-admin --secret test4242 user create
$ radosgw-admin caps add --uid="oidc-admin" --caps="oidc-provider=*"
  1. Register the the OpenID Connect provider using the AWS CLI:
$ export AWS_ACCESS_KEY_ID=oidc-admin
$ export AWS_SECRET_ACCESS_KEY=test123
$ aws --endpoint-url http://{RADOS Gateway endpoint} iam create-open-id-connect-provider \
  --url https://{Authorization Server} \ # Authorization Server designates your INDIGO IAM instance
  --client-id-list {CLIENT_ID} \
  --thumbprint-list CF6CD9212F24FE6A98C697A0BBCD83861C80FCDC # SHA-1 thumbprint from earlier
  1. Ensure the provider has been created:
$ aws --endpoint-url http://{RADOS Gateway endpoint}  iam list-open-id-connect-providers
{
    "OpenIDConnectProviderList": [
        {
            "Arn": "arn:aws:iam:::oidc-provider/{Authorization Server}"
        }
    ]
}
  1. We will also use the oidc-admin user to create roles, give it this capability like this:
$ radosgw-admin caps add --uid="oidc-admin" --caps="roles=*"

Resources

https://blog.oziol.fr/posts/atom.xml