Repository navigation
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 |
Point the temporary barman-cloud replace at the head of cloudnative-pg/barman-cloud#284 that keeps each SSE-C key in its own file. A replica cluster archives WAL to its own object store while restoring it from the source one in the same sidecar, and with a single shared file each operation could run with the key of the other object store. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Also points the temporary barman-cloud replace at the head of cloudnative-pg/barman-cloud#284 that serializes the writes of the SSE-C key files. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
barman-cloud refuses --sse-customer-key together with --encryption, so an ObjectStore setting both sseCustomerKey and data or wal encryption was accepted and then failed at its first backup or WAL archive. Reject it when it is created or updated instead. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Run the replica cluster scenario with the source and the replica object stores each encrypted with its own SSE-C key kept in its own secret. The designated primary archives WAL to one object store while restoring it from the other in the same sidecar, and the switchover exercises both directions. At the end, check that every object in each bucket is readable with its own key only, and that an ObjectStore combining SSE-C with bucket-managed encryption is rejected. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Point the temporary barman-cloud replace at the head of cloudnative-pg/barman-cloud#284 that stops passing --sse-customer-key to barman-cloud-check-wal-archive. That command rejects the option, and it runs before the first WAL file is archived, so an object store with an SSE-C key could never start archiving. The SSE-C e2e test caught it. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
|
I pushed a few commits on top:
That e2e is what found the |
| When set, every object barman-cloud uploads to and downloads from | ||
| S3 is encrypted with this key using the AWS SSE-C protocol | ||
| (the `--sse-customer-key` barman-cloud option). |
There was a problem hiding this comment.
Following the same suggestion I left in: https://github.com/cloudnative-pg/barman-cloud/pull/284/changes#r4197823691
| When set, every object barman-cloud uploads to and downloads from | |
| S3 is encrypted with this key using the AWS SSE-C protocol | |
| (the `--sse-customer-key` barman-cloud option). | |
| // When set, it is the key barman-cloud uses to encrypt objects uploaded | |
| // to S3 and to decrypt them when they are read back, following the AWS | |
| // SSE-C protocol (the `--sse-customer-key` barman-cloud option). |
| When set, every object barman-cloud uploads to and downloads from | ||
| S3 is encrypted with this key using the AWS SSE-C protocol | ||
| (the `--sse-customer-key` barman-cloud option). |
There was a problem hiding this comment.
Following the same suggestion I left in: https://github.com/cloudnative-pg/barman-cloud/pull/284/changes#r4197823691
| When set, every object barman-cloud uploads to and downloads from | |
| S3 is encrypted with this key using the AWS SSE-C protocol | |
| (the `--sse-customer-key` barman-cloud option). | |
| // When set, it is the key barman-cloud uses to encrypt objects uploaded | |
| // to S3 and to decrypt them when they are read back, following the AWS | |
| // SSE-C protocol (the `--sse-customer-key` barman-cloud option).``` |
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