SSE-S3 with Vault Agent for RGW (Dev Preview - ODF 4.22)
Important: A developer preview feature is subject to Developer preview support limitations. Developer preview features are not intended to be run in production environments. The clusters deployed with the developer preview features are considered to be development clusters and are not supported through the Red Hat Customer Portal case management system. Development Preview features are meant for customers who are willing to evaluate new products or releases of products in an early stage of product development. If you need assistance with developer preview features, reach out to the ocs-devpreview@redhat.com mailing list and a member of the Red Hat Development Team will assist you as quickly as possible based on availability and work schedules. To know more about the support scope refer to the This content is not included.KCS
What is SSE-S3?
Server-Side Encryption S3(SSE-S3) is a form of encryption where all objects stored in an S3-compatible object store (RGW) are encrypted by default using keys managed by aKMS.- Unlike
SSE-KMS, where the client must specify aKMSkey ID per request,SSE-S3encrypts every object transparently without any client-side configuration.
What is a Vault Agent?
VaultAgent is a daemon that runs alongside applications and handles authentication toVaultautomatically.- Instead of requiring a long-lived
Vault token(as theSSE-KMStoken-based method does), Vault Agent authenticates using the Kubernetesservice accountand maintains a cached, automatically renewed token. - ODF deploys a standalone
VaultAgent Deployment (2 replicas) that exposes a localHTTP caching proxyon port8100.RGWconnects to this proxy instead of directly to theVault server.
Prerequisites
- ODF cluster with encryption enabled (
spec.encryption.enable: trueorspec.encryption.clusterWide: trueon theStorageClusterCR, or at least one encrypted device set) KMSenabled on theStorageCluster(spec.encryption.kms.enable: true)- A running
HashiCorp Vault instancewith:- The
Transit secrets engineenabled - Kubernetes auth method configured and the OpenShift cluster registered as a trusted auth source.
- A
Vault policyand role granting the vault-agent-rgw service account access to the transit engine.
- The
Setup Steps
-
Configure
Vault Server:-
Enable the Transit secrets engine (not KV because SSE-S3 uses Transit for envelope encryption):
$ vault auth enable kubernetes -
Enable and configure Kubernetes
auth(if not already done for clusterwide/PV encryption):$ vault auth enable kubernetes $ SA_CA_CRT=$(oc -n openshift-storage get secret odf-vault-auth-token -o jsonpath="{.data['ca\.crt']}" | base64 --decode; echo) $ OCP_HOST=$(oc config view --minify --flatten -o jsonpath="{.clusters[0].cluster.server}") $ vault write auth/kubernetes/config \ kubernetes_host="$OCP_HOST" \ kubernetes_ca_cert="$SA_CA_CRT" -
Create a policy for
RGWtransit operations:$ echo ' path "transit/keys/*" { capabilities = ["create", "read", "update", "delete"] } path "transit/encrypt/*" { capabilities = ["create", "read", "update"] } path "transit/decrypt/*" { capabilities = ["create", "read", "update"] }' | vault policy write rgw-sse-s3 - -
Create a Kubernetes
auth rolefor theVault Agentservice account:$ vault write auth/kubernetes/role/rook-ceph-rgw \ bound_service_account_names=vault-agent-rgw \ bound_service_account_namespaces=openshift-storage \ policies=rgw-sse-s3 \ ttl=1hNOTE: The default role name is rook-ceph-rgw. If you use a different role name, set VAULT_RGW_ROLE in the KMS ConfigMap (Step 2).
-
-
Create or Update the
KMS ConfigMap:-
Create (or update) the
ocs-kms-connection-detailsConfigMap in theopenshift-storagenamespace:apiVersion: v1 kind: ConfigMap metadata: name: ocs-kms-connection-details namespace: openshift-storage data: KMS_PROVIDER: vault VAULT_ADDR: https://vault.example.com:8200 VAULT_RGW_AUTH_METHOD: agent #Optional overrides (defaults shown): #VAULT_RGW_ROLE: rook-ceph-rgw #VAULT_RGW_AUTH_MOUNT_PATH: auth/kubernetesNOTE: The existing keys for clusterwide and PV encryption (VAULT_BACKEND_PATH, VAULT_BACKEND, etc.) remain in this ConfigMap and are unaffected. SSE-S3 configuration uses separate keys (VAULT_RGW_*).
-
-
Configure
TLS(ifVaultusesTLS):-
If your
Vault serverusesTLS, create KubernetesSecretscontaining the certificates and reference them in the KMSConfigMap:#Create secret for CA certificate $ oc create secret generic vault-ca-cert \ --from-file=cert=/path/to/ca.pem \ -n openshift-storage #Create secret for client certificate (if using mTLS) $ oc create secret generic vault-client-cert \ --from-file=cert=/path/to/client-cert.pem \ -n openshift-storage #Create secret for client key (if using mTLS) $ oc create secret generic vault-client-key \ --from-file=key=/path/to/client-key.pem \ -n openshift-storage
Then set the corresponding keys in the KMS
ConfigMap:``` data: VAULT_CACERT: vault-ca-cert VAULT_CLIENT_CERT: vault-client-cert VAULT_CLIENT_KEY: vault-client-key ``` -
-
Set the
Vault Agent Image(Dev Preview only):-
Since this is a Dev Preview feature, the
Vault Agent container imagemust be set manually on the OCS operator deployment:$ oc set env deployment/ocs-operator \ VAULT_AGENT_IMAGE=hashicorp/vault:latest \ -n openshift-storageNOTE: For GA, this image will be added to the ClusterServiceVersion and set automatically.
-
-
Enable Encryption on the
StorageCluster:-
Ensure your
StorageClusterCR has encryption and KMS enabled:apiVersion: ocs.openshift.io/v1 kind: StorageCluster metadata: name: ocs-storagecluster namespace: openshift-storage spec: encryption: enable: true kms: enable: true -
When all conditions are met, ODF automatically creates the following resources in the
openshift-storagenamespace:
| Resource Type | Name | Description |
| --- | --- | --- |
| ServiceAccount | vault-agent-rgw | Identity for Vault Kubernetes auth |
| ConfigMap | vault-agent-rgw-config | Generated Vault Agent HCL configuration |
| Deployment | vault-agent-rgw | 2-replica Vault Agent with cache listener on port 8100 |
| Service | vault-agent-rgw | ClusterIP service exposing port 8100 | -
The
CephObjectStoreis configured withSSE-S3pointing to theVault Agent service:security: serverSideEncryptionS3: connectionDetails: KMS_PROVIDER: vault VAULT_ADDR: http://vault-agent-rgw.openshift-storage.svc:8100 VAULT_AUTH_METHOD: agent VAULT_SECRET_ENGINE: transit
-
Verification
- steps:
-
Check the
Vault Agent pods:$ oc get pods -l app=vault-agent-rgw -n openshift-storage -
Check the
Vault Agent service:$ oc get svc vault-agent-rgw -n openshift-storage -
Verify
RGWhasSSE-S3configured:$ oc get cephobjectstore -n openshift-storage -o yaml | grep -A5 serverSideEncryptionS3
-
Troubleshooting
-
Vault Agent pods not starting
-
Check that the
VAULT_AGENT_IMAGEenvironment variable is set on theocs-operatordeployment:$ oc get deployment ocs-operator -n openshift-storage \ -o jsonpath='{.spec.template.spec.containers[0].env}' | jq '.[] | select(.name=="VAULT_AGENT_IMAGE")'
-
-
Vault Agentfails to authenticate:-
Verify the
VaultKubernetes auth role is configured correctly:$ vault read auth/kubernetes/role/rook-ceph-rgwEnsure:
-- bound_service_account_names includes vault-agent-rgw
-- bound_service_account_namespaces includes openshift-storage
-
-
RGWnot using encryption:-
Check the
KMS ConfigMaphasVAULT_RGW_AUTH_METHODset:$ oc get configmap ocs-kms-connection-details -n openshift-storage -o yaml -
Verify encryption is enabled on the
StorageCluster:$ oc get storagecluster -n openshift-storage -o jsonpath='{.items[0].spec.encryption}'
-
-
Checking logs:
-
The
rook-ceph-operatorwill contain logs forRGWencryption configuration:$ oc logs deployment/rook-ceph-operator -n openshift-storage | grep -i "sse\|vault\|encrypt" -
The
ocs-operatorwill contain logs forVault Agentdeployment:$ oc logs deployment/ocs-operator -n openshift-storage | grep -i "vault-agent\|vault agent"
-
KMS resources specific to SSE-S3
ocs-kms-connection-detailsConfigMap (shared with clusterwide/PV encryption; SSE-S3 uses the VAULT_RGW_* keys)vault-agent-rgw-configConfigMap (auto-generated HCL config)vault-agent-rgwServiceAccount, Deployment, and Service