feat: support S3 SSE-C (customer-provided encryption keys) - #1017
feat: support S3 SSE-C (customer-provided encryption keys)#1017schaurian wants to merge 2 commits into
Conversation
0a40feb to
adb7045
Compare
|
Tested at Two changes were required:
With those:
|
Surface the new `sseCustomerKey` field on `s3Credentials` through the ObjectStore CRD so users can enable Server-Side Encryption with Customer-provided keys (SSE-C). This is required by S3-compatible providers that only support SSE-C for encryption at rest, such as Hetzner Object Storage. The field flows through the embedded BarmanObjectStoreConfiguration from the barman-cloud library, so this change is limited to bumping the dependency, regenerating the CRD and the consolidated manifest, and documenting usage in the object stores guide. Depends on cloudnative-pg/barman-cloud#284 (temporarily pinned via a replace directive until that change is released). Closes cloudnative-pg#646 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Florian Schauer <florian@schauer.to>
The sidecar reads credential secrets through a Role whose resource names are collected from the credential references. Without the new reference in that list, a key kept in its own secret, as in the docs example, is forbidden and every barman-cloud command fails. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Andrei Nistor <andrei@nistor.tech>
0b42a5f to
eed228a
Compare
|
Thanks for the end-to-end run and the RBAC fix, @andrein — merged schaurian#1 into this branch. Updated the branch (
Local One observation: the plugin does not call |
Summary
Adds support for S3 Server-Side Encryption with Customer-provided keys (SSE-C) to the ObjectStore resource, closing #646.
S3-compatible providers such as Hetzner Object Storage do not offer bucket-managed encryption (SSE-S3 / SSE-KMS) and only support SSE-C. Without this, backups and WALs can only be stored unencrypted at rest on those providers.
Users can now reference a secret holding a base64-encoded 256-bit AES key via a new
sseCustomerKeyfield:What changed
The field is defined in the shared barman-cloud library and flows through the embedded
BarmanObjectStoreConfiguration, so the plugin change is intentionally small:go.mod/go.sumbarman-cloudat the version carryingsseCustomerKey(see below)internal/cnpgi/operator/specs/secrets.gosseCustomerKeyinCollectSecretNamesFromCredentials, so the instance Role covers a key kept in its own Secret (by @andrein, with test)config/crd/bases/…_objectstores.yamlsseCustomerKey)manifest.yamlweb/docs/object_stores.md.wordlist.txtNo controller logic changes are needed: the library injects
--sse-customer-key file://…into everybarman-cloud-*command (backup, wal-archive, wal-restore, restore, backup-list, backup-delete, check-wal-archive) and materializes the key from its secret, so all read/write paths are covered.sseCustomerKeycannot be combined withdata.encryption/wal.encryption: barman-cloud rejects--sse-customer-keytogether with--encryption. barman-cloud#284 adds that check toValidateBackupConfiguration; note that this plugin does not currently callValidateBackupConfigurationforObjectStoreobjects, so today the combination is only caught at run time (documented as such). Happy to wire the validation into the plugin in a follow-up if you'd like it enforced at admission.Dependency
This PR depends on cloudnative-pg/barman-cloud#284. Until that is merged and released,
go.modcarries a temporaryreplacedirective pointing at the PR head:Once barman-cloud#284 is released, the
replaceshould be dropped and therequirebumped to the released version.Runtime use requires Barman ≥ 3.20.0 (
--sse-customer-keyoption), which the sidecar image pins since v0.15.0 — this branch is rebased onmainaccordingly.Testing
task cirun locally: commitlint, spellcheck,go test(envtest), uncommitted-drift check (CRD / manifest / API docs regenerated via the repo's dagger tasks), docusaurus build, and the ephemeral-k3s e2e suite — 10 passed, 0 failed, 4 skipped (the GCS specs disabled pending barman-cloud-backup 3.20.0 should respectSTORAGE_EMULATOR_HOSTduring multiplepart backup EnterpriseDB/barman#1218). golangci-lint reports onlygomoddirectiveson the temporaryreplaceline above, which goes away once thereplaceis dropped.manifest.yamldiff to exactly the new field.Encryption: SSE-Cobjects, base backup,backup-list, retention viabackup-delete,serverRecoveryWindow, and recovery into a newClusterviaexternalClusters[].plugin) — see the comment below.Closes #646
🤖 Generated with Claude Code