ceph: revert kms VAULT_KV_VERS to VAULT_BACKEND
The vault env variable VAULT_BACKEND is read by the secret library so we
must not change it. This is reverting
ee6a03dfb8 with a few extra fixes for the
rgw code.
Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
10547a4e2f
commit
e4c3a4cef7
6 files changed
+18
-11
No files matched your search
@@ -1414,7 +1414,7 @@ security:
|
||||
KMS_PROVIDER: vault
|
||||
VAULT_ADDR: https://vault.default.svc.cluster.local:8200
|
||||
VAULT_BACKEND_PATH: rook
|
||||
VAULT_BACKEND: kv
|
||||
VAULT_SECRET_ENGINE: kv
|
||||
# name of the k8s secret containing the kms authentication token
|
||||
tokenSecretName: rook-vault-token
|
||||
```
|
||||
@@ -1512,7 +1512,7 @@ Communications will remain encrypted but the validity of the certificate will no
|
||||
|
||||
For RGW, please note the following:
|
||||
|
||||
* `VAULT_BACKEND` option is specifically for RGW to mention about the secret engine which can be used, currently supports two: [kv](https://www.vaultproject.io/docs/secrets/kv) and [transit](https://www.vaultproject.io/docs/secrets/transit).
|
||||
* `VAULT_SECRET_ENGINE` option is specifically for RGW to mention about the secret engine which can be used, currently supports two: [kv](https://www.vaultproject.io/docs/secrets/kv) and [transit](https://www.vaultproject.io/docs/secrets/transit).
|
||||
* The Storage administrator needs to create a secret in the Vault server so that S3 clients use that key for encryption
|
||||
```console
|
||||
# kv engine
|
||||
|
||||
@@ -180,7 +180,7 @@ spec:
|
||||
#KMS_PROVIDER: "vault"
|
||||
#VAULT_ADDR: VAULT_ADDR_CHANGE_ME # e,g: https://vault.my-domain.com:8200
|
||||
#VAULT_BACKEND_PATH: "rook"
|
||||
#VAULT_BACKEND: "kv"
|
||||
#VAULT_SECRET_ENGINE: "kv"
|
||||
# # name of the secret containing the kms authentication token
|
||||
# tokenSecretName: rook-vault-token
|
||||
# UNCOMMENT THIS TO ENABLE A KMS CONNECTION
|
||||
|
||||
@@ -32,6 +32,12 @@ import (
|
||||
const (
|
||||
// EtcVaultDir is vault config dir
|
||||
EtcVaultDir = "/etc/vault"
|
||||
// VaultSecretEngineKey is the type of secret engine used (kv, transit)
|
||||
VaultSecretEngineKey = "VAULT_SECRET_ENGINE"
|
||||
// VaultKVSecretEngineKey is a kv secret engine type
|
||||
VaultKVSecretEngineKey = "kv"
|
||||
// VaultTransitSecretEngineKey is a transit secret engine type
|
||||
VaultTransitSecretEngineKey = "transit"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -191,12 +191,13 @@ if [ -n "$VAULT_TLS_SERVER_NAME" ]; then
|
||||
fi
|
||||
|
||||
# Check KV engine version
|
||||
if [ -z "$VAULT_KV_VERS" ]; then
|
||||
VAULT_KV_VERS=$VAULT_DEFAULT_KV_VERS
|
||||
if [ -z "$VAULT_BACKEND" ]; then
|
||||
VAULT_BACKEND=$VAULT_DEFAULT_KV_VERS
|
||||
fi
|
||||
|
||||
# Get the Key Encryption Key
|
||||
curl "${ARGS[@]}" "$VAULT_ADDR"/"$VAULT_KV_VERS"/"$VAULT_BACKEND_PATH"/"$KEK_NAME" > "$CURL_PAYLOAD"
|
||||
curl "${ARGS[@]}" "$VAULT_ADDR"/"$VAULT_BACKEND"/"$VAULT_BACKEND_PATH"/"$KEK_NAME" > "$CURL_PAYLOAD"
|
||||
|
||||
|
||||
# Check for errors in the payload
|
||||
if python3 -c "import sys, json; print(json.load(sys.stdin)[\"errors\"], end='')" 2> /dev/null < "$CURL_PAYLOAD"; then
|
||||
|
||||
@@ -246,7 +246,7 @@ func (c *clusterConfig) makeDaemonContainer(rgwConfig *rgwConfig) v1.Container {
|
||||
path.Join(c.DataPathMap.ContainerDataDir, kms.VaultFileName)),
|
||||
cephconfig.NewFlag("rgw crypt vault prefix", c.vaultPrefixRGW()),
|
||||
cephconfig.NewFlag("rgw crypt vault secret engine",
|
||||
c.clusterSpec.Security.KeyManagementService.ConnectionDetails[vault.VaultBackendKey]),
|
||||
c.clusterSpec.Security.KeyManagementService.ConnectionDetails[kms.VaultSecretEngineKey]),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -401,14 +401,14 @@ func (c *clusterConfig) reconcileService(cephObjectStore *cephv1.CephObjectStore
|
||||
}
|
||||
|
||||
func (c *clusterConfig) vaultPrefixRGW() string {
|
||||
secretEngine := c.clusterSpec.Security.KeyManagementService.ConnectionDetails[vault.VaultBackendKey]
|
||||
secretEngine := c.clusterSpec.Security.KeyManagementService.ConnectionDetails[kms.VaultSecretEngineKey]
|
||||
vaultPrefixPath := "/v1/"
|
||||
|
||||
switch secretEngine {
|
||||
case "kv":
|
||||
case kms.VaultKVSecretEngineKey:
|
||||
vaultPrefixPath = path.Join(vaultPrefixPath,
|
||||
c.clusterSpec.Security.KeyManagementService.ConnectionDetails[vault.VaultBackendPathKey])
|
||||
case "transit":
|
||||
case kms.VaultTransitSecretEngineKey:
|
||||
vaultPrefixPath = path.Join(vaultPrefixPath, secretEngine, "/export/encryption-key")
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ spec:
|
||||
KMS_PROVIDER: vault
|
||||
VAULT_ADDR: https://vault.default.svc.cluster.local:8200
|
||||
VAULT_BACKEND_PATH: rook
|
||||
VAULT_BACKEND: kv
|
||||
VAULT_SECRET_ENGINE: kv
|
||||
VAULT_SKIP_VERIFY: "true"
|
||||
tokenSecretName: rook-vault-token
|
||||
Reference in new issue
Block a user