Feature request: OIDC / STS AssumeRoleWithWebIdentity authentication for S3-compatible ObjectStores

未关闭
#1,148 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

这个 Issue 还没有评估数据。

描述

Currently, when using an S3-compatible third-party object store, the ObjectStore CRD supports providing an access key and secret key, with an optional session token.

spec:
  configuration:
    destinationPath: s3://backups/
    endpointURL: https://minio.example.com
    s3Credentials:
      accessKeyId:
        name: object-store
        key: ACCESS_KEY_ID
      secretAccessKey:
        name: object-store
        key: ACCESS_SECRET_KEY
      sessionToken:
        name: object-store
        key: ACCESS_SESSION_TOKEN

This works well for long-lived credentials, but it does not work well for environments where authentication to the object store is based on OIDC federation and short-lived STS credentials.

The Barman Cloud Plugin currently documents access-key authentication and IRSA for S3. For S3-compatible providers, endpointURL can already be used to target a non-AWS S3 service.

Use case

We operate an on-premises S3-compatible object store using MinIO.

MinIO is configured to trust our OIDC identity provider. Rather than creating permanent MinIO access keys for PostgreSQL backups, we would like Barman Cloud to authenticate using the following flow:

OIDC Identity Provider
        |
        | OAuth/OIDC token
        v
S3-compatible STS endpoint
AssumeRoleWithWebIdentity
        |
        | 1hr temporary AccessKeyId
        | 1hr temporary SecretAccessKey
        | 1hr temporary SessionToken
        v
Barman Cloud
        |
        v
S3 backup / WAL operations

In our environment the identity provider is Microsoft Entra ID, but the proposed feature should not be specific to Entra ID.

The same mechanism should be usable with any standards-compatible OIDC provider, such as Keycloak or other identity providers, together with any S3-compatible implementation supporting AssumeRoleWithWebIdentity.

The important distinction from the existing credential configuration is that the resulting S3 credentials are short-lived. In our environment they expire approximately hourly.

Therefore, storing the resulting:

  • AccessKeyId
  • SecretAccessKey
  • SessionToken

in a Kubernetes Secret is not sufficient. The plugin needs to be able to acquire and refresh these credentials automatically.

Proposed behavior

It would be useful if the ObjectStore CRD supported an additional authentication method under s3Credentials, for example webIdentity.

The plugin would:

  • Authenticate to the configured OIDC token endpoint using the configured client credentials.

  • Obtain an OIDC/OAuth token.

  • Present that token to the S3-compatible STS endpoint using AssumeRoleWithWebIdentity.

  • Receive temporary:

    • Access key ID
    • Secret access key
    • Session token
    • Expiration
  • Use those credentials for Barman Cloud S3 operations.

  • Automatically repeat the process before the credentials expire.

  • This would allow Barman Cloud deployments to avoid permanent S3 credentials entirely.

Example proposed ObjectStore spec

One possible ObjectStore CRD could look like this

apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
  name: my-oidc-s3-store
spec:
  configuration:
    destinationPath: s3://postgres-backups/
    endpointURL: https://minio.example.com

    s3Credentials:
      webIdentity:
        tokenEndpoint: https://idp.example.com/oauth2/v2.0/token
          trustedCA:
             name: <Optional name of secret>
             key: <Optional name of value; IE ca.crt>
        clientId:
          name: barman-oidc
          key: CLIENT_ID
        clientSecret:
          name: barman-oidc
          key: CLIENT_SECRET
        scope:
          name: barman-oidc
          key: SCOPE
        stsEndpoint: https://minio.example.com
    wal:
      compression: gzip:

This approach also assumes that Roles are handled properly via OIDC claims.

Proposed Acceptance criteria

  1. ObjectStore supports an OIDC/web-identity authentication option for S3-compatible storage.
  2. The identity provider is configurable and is not tied specifically to AWS, Microsoft Entra ID, Keycloak, or another vendor.
  3. Client credentials can be referenced from Kubernetes Secrets.
  4. The OIDC token endpoint and S3 STS endpoint can be independently configured.
  5. The obtained identity token can be exchanged through AssumeRoleWithWebIdentity.
  6. Returned S3 AccessKeyId, SecretAccessKey, and SessionToken credentials are used transparently by Barman Cloud.
  7. Credentials are refreshed automatically before expiration.
  8. Backup, WAL archive, WAL restore, and recovery operations all use the same credential mechanism.
  9. Existing static S3 credential and IRSA authentication mechanisms continue to work unchanged.
主要语言
Go
星标
219
派生
92
平均合并
2 天 11 小时
30 天内合并 PR
38

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudnative-pg/plugin-barman-cloud 的其他 Issue

查看 cloudnative-pg/plugin-barman-cloud 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。