From 7e0b58cc27ac5198547ea465daeddcc715aece6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Fri, 9 Jul 2021 11:03:17 +0200 Subject: [PATCH] ceph: destroy all vault keys on kv version 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, keys stored in Vault KV Secret Engine are versioned and keys are soft-deleted, see Vault documentation: When deleting data the standard vault kv delete command will perform a soft delete. It will mark the version as deleted and populate a deletion_time timestamp. Soft deletes do not remove the underlying version data from storage, which allows the version to be undeleted. The vault kv undelete command handles undeleting versions. A version's data is permanently deleted only when the key has more versions than are allowed by the max-versions setting, or when using vault kv destroy. When the destroy command is used the underlying version data will be removed and the key metadata will be marked as destroyed. If a version is cleaned up by going over max-versions the version metadata will also be removed from the key. Signed-off-by: Sébastien Han --- pkg/daemon/ceph/osd/kms/kms.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/daemon/ceph/osd/kms/kms.go b/pkg/daemon/ceph/osd/kms/kms.go index f2f45f227..8730383c9 100644 --- a/pkg/daemon/ceph/osd/kms/kms.go +++ b/pkg/daemon/ceph/osd/kms/kms.go @@ -126,6 +126,10 @@ func (c *Config) DeleteSecret(secretName string) error { } k := buildKeyContext(c.clusterSpec.Security.KeyManagementService.ConnectionDetails) + + // Force removal of all the versions of the secret on K/V version 2 + k[secrets.DestroySecret] = "true" + err = delete(v, GenerateOSDEncryptionSecretName(secretName), k) if err != nil { return errors.Wrap(err, "failed to delete secret in vault")