Secret Service

Secret Service in Anywhere Cloud provides a secure, central store for sensitive information such as passwords, API keys, tokens, and certificates that your applications and Cloudera Data Services rely on.

Instead of hardcoding these values or scattering them across configuration files, you store them once in Secret Service and let your services retrieve them safely when needed. Secret Service helps you to:

  • Keep sensitive data protected – secrets are stored securely and kept separate from your application code and configuration.
  • Control who can access what – each secret is private to its owner, and you can share it only when you choose.
  • Simplify management – update or rotate a secret in one place without changing every application that uses it.

External vault requirements for Secret Service

External HashiCorp Vault integration for Secret Service in Anywhere Cloud requires configuring a bootstrap token policy, generating a bootstrap token, and retrieving Certificate Authority (CA) certificates before Data Service deployment.

The Secret Service service in Cloudera Anywhere Cloud uses an external vault to securely store your passwords, tokens, certificates, and encryption keys. Before you deploy Cloudera Data Services on Anywhere Cloud, you must prepare the external vault. After you complete these prerequisites, configure Secret Service by using either the Cloudera console or the backend API.

HashiCorp Vault server requirements

Secret Service in Cloudera Anywhere Cloud connects to any external HashiCorp Vault server and does not require a specific Vault version. The Vault instance must be reachable, unsealed, and support the following capabilities:

  • Key/Value (KV) v2 secrets engine
  • JSON Web Token (JWT) authentication method
  • Access Control List (ACL) policies

Vault token policy

Create a Vault token with a dedicated bootstrap policy, for example, the ss-bootstrap policy, that allows full lifecycle management of secret engines. This policy is used only for the initial vault setup and becomes obsolete after bootstrapping is finalized.

Run the following commands to create the ss-bootstrap policy:

export VAULT_NAMESPACE="admin/my-namespace"   # Scopes the following CLI commands; skip when Vault has no namespaces

vault policy write ss-bootstrap - <<'EOF'
path "sys/mounts/*"        { capabilities = ["create", "update"] }
path "+/config"           { capabilities = ["create", "update"] }
path "+/metadata/*"       { capabilities = ["read"] }
path "sys/auth/*"         { capabilities = ["create", "update", "sudo"] }
path "auth/+/config"      { capabilities = ["create", "update"] }
path "sys/policies/acl/*" { capabilities = ["create", "update"] }
path "auth/+/role/*"      { capabilities = ["create", "update", "read"] }
EOF

Vault token use

Generate a bootstrap token. If a Vault namespace is enabled, generate the token under that namespace. Specify a Time to Live (TTL) value long enough for Secret Service to deploy before the token expires. Because this token is required only for preliminary vault configuration, your administrator can revoke it after Secret Service deployment is finalized. Provide this token when you configure Secret Service, as the Vault token field in the Cloudera console, or in the /api/v1/secret-service/config/ backend API.

Run the following commands to generate the bootstrap token. Set a TTL long enough to finish configuring Secret Service; the token can expire after configuration succeeds.

export VAULT_NAMESPACE="admin/my-namespace"   # Or set "admin" as appropriate

vault token create \
  -orphan \
  -display-name="secret-service-bootstrap" \
  -policy="ss-bootstrap" \
  -ttl="vault-token-ttl" \
  -format=json | jq -r '.auth.client_token'

Vault CA certificate

You need a CA certificate only if your Vault server's Transport Layer Security (TLS) certificate is issued by a private Certificate Authority (CA). If your Vault server uses a certificate from a publicly trusted CA, skip this step.

Obtain the CA certificate in PEM format from the team that manages your Vault server or your organization's public key infrastructure (PKI). If the chain includes intermediate CAs, include them in the same file. Save the certificate as vault-ca.pem.

Optionally, verify that the certificate validates your Vault server by running the following command from a machine that can reach Vault:

openssl s_client -connect vault.example.com:8200 \
  -servername vault.example.com \
  -CAfile vault-ca.pem \
  -verify_return_error </dev/null

A successful check ends with Verify return code: 0 (ok). If the command reports a verification error, the certificate does not match your Vault server; check with your Vault or PKI team.

Provide the vault-ca.pem file when you connect the vault in the Anywhere Cloud Console or through the API.

Vault resources created during installation

Secret Service creates instance-scoped resources at the following paths:

  • KV v2 secrets engine – kv-{instance-digest}/
  • JWT auth method – jwt-{instance-digest}/
  • Policy – scs-service-{instance-digest}
  • Service role – {instance-digest}-service-role

Connecting a vault in the Anywhere Cloud Console

Connect an external HashiCorp Vault instance to Secret Service in the Anywhere Cloud console by entering your Vault endpoint, bootstrap token, namespace, and CA certificate.

  • You have completed the steps in External vault requirements for Secret Service.
  • You have the vault-ca.pem file available if your Vault server uses a private CA certificate.
  • You must hold the Platform Admin role to manage and configure Secret Service and the Vault connection.
  1. Log in to the Cloudera Anywhere Cloud console.
  2. Go to Admin Center > Security > Secrets > Connect Vault.
  3. Enter the required Vault parameters in their respective fields, as described in the Vault connection parameters table.
  4. Click Test vault connection to verify that the values you entered are valid and that the cluster can reach the Vault server.

    If the test fails, the console displays an error that identifies the problem, for example, vault address is not a valid URL. Correct the values, and then test the connection again.

  5. Click Connect Vault.
    Parameter Description
    Vault address Specifies the Vault API URL, for example, https://vault.example.com:8200. The URL must use HTTPS. Required.
    Vault token Specifies the bootstrap token used for one-time Secret Service setup. The token must be valid in the configured Vault namespace. Required.
    Vault CA certificate Specifies the CA certificate required when Vault uses a private CA. Not required for a publicly trusted CA.
    Vault namespace Specifies the Vault Enterprise namespace (VAULT_NAMESPACE). Required when namespaces are enabled; leave empty for non-Enterprise Vault. Specify the full path with no trailing slash, for example, admin or admin/my-namespace.
    Vault JWT role token TTL Specifies the Time to Live (TTL) for the Vault tokens that Secret Service requests for itself to read and write secrets, for example, 30s, 5m, 1h, or 1d.
    Per-owner secret limit Specifies the maximum number of active secrets per owner, which can be a user or a service identity.
    Maximum secret payload size (bytes) Specifies the maximum total size, in UTF-8 bytes, of all inputs that compose a single secret, including the secret description, the keys and values for string-type secrets, and the file size for binary-type secrets. The default is 64 KB.

Adding a Secret

Add secrets in Anywhere Cloud to securely store key-value credentials or binary files for your workloads.

After you configure the external vault, you can add secrets in the Cloudera Anywhere Cloud console.

  1. Log in to the Cloudera Anywhere Cloud console.
  2. Go to Admin Center > Security > Secrets.
  3. On the Secrets page, click Add Secret.
  4. Specify the following details for the secret:
    • Name – Enter a unique name for the secret.
    • Description – Enter an optional description for the secret.
    • Type – Select one of the following secret formats:
      • Key-value pairs – Enter string key-value pairs, for example, key username with value user1, and key password with value 12356.
      • Binary file – Upload a binary file as the credential value.
  5. Click Add Secret.

The added secret is displayed on the Manage Secrets page.

New secrets are private: only you can see and use them. A secret becomes shareable when you share it for the first time. For more information, see Sharing secrets.

Editing a secret

Update the description or replace the values of a secret, for example, to rotate a password or an API key.

You can edit a secret that you own, or a secret for which you have the Edit and use permission.

You cannot change the name or the type of a secret. To rename a secret or change its type, add a new secret and delete the old one.

Replacing the values of a secret overwrites the stored values. You cannot recover the previous values.

You own the secret, or you have the Edit and use permission for the secret.

  1. Go to Admin Center > Security > Secrets.
  2. Find the secret, click the More actions icon, and then select Edit.
  3. In the Edit secret panel, make your changes:
    • Description – Update the description of the secret.
    • Key-value pairs – To keep the current values, leave the key and value fields empty. To replace the values, enter every key-value pair that the secret must contain. Because the new pairs replace all existing pairs, also enter the pairs that you do not want to change. The panel displays how many pairs the secret contained when it was last updated.
    • Binary file – To replace the file, upload a new file. To keep the current file, do not upload a file.
  4. Click Save.

The secret is updated, and the console displays the Secret updated message.

If another user changed the secret after you opened it, the console displays the This secret changed since you opened it. message. Reload the list, and edit the secret again.

Sharing secrets

Share a secret with specific users and assign usage or editing permissions in the Anywhere Cloud console.

  1. On the Secrets page, select the secret that you want to share.
  2. Click the More actions icon, and then select Share.
  3. In the Share secret dialog box, select the user with whom you want to share the secret.
  4. Select one of the following permissions from the drop-down list:
    • Use secret – Allows the user only to use the secret.
    • Edit and use – Allows the user to edit the key and use the secret.
  5. Optional: To revoke access for an existing user, click the Delete icon next to the user.
  6. Click Save.

The shared secret is displayed on the Manage Secrets page.

Deleting a secret

Permanently delete a secret that you own and no longer need, which removes access for all users and services that rely on it.

Only the owner of a secret can delete it. Deletion is permanent, and you cannot recover a deleted secret. Users with whom the secret is shared lose access to it, and services that use the secret can no longer read it.

Before you delete a secret, check which services use it.

You own the secret.

  1. Go to Admin Center > Security > Secrets.
  2. Find the secret, click the More actions icon, and then select Delete.
  3. In the Delete secret dialog box, type the name of the secret to confirm.
  4. Click Delete secret.

The secret is deleted and removed from the list, and the console displays the Secret deleted message.

Workload access to secrets

Cloudera Data Services and engines read secrets through the Secret Service API, never directly from your external Vault instance.

Secrets are stored in your external Vault instance, not in Cloudera Anywhere Cloud. When a workload needs a secret, it calls the Secret Service API. Secret Service reads the secret from Vault by using short-lived Vault tokens that it requests for itself. Workloads do not receive Vault credentials. For more information about token lifetimes, see the Vault JWT role token TTL parameter.

A caller can read a secret only if it owns the secret, or if the secret is shared with it directly or through a role. A caller can be a user or a service. When a service acts on behalf of a user, for example by presenting that user's token, Secret Service treats the request as coming from that user.

Only Anywhere Cloud Secret Service connects to Vault, so your workload clusters do not need network access to your Vault instance.

Connecting a vault by using the API

Enable Secret Service on Anywhere Cloud by using Helm and connect your external HashiCorp Vault instance through the backend configuration API.

Supply the Vault connection details, including the address, token, and Certificate Authority (CA) certificate, through the backend configuration API instead of Helm values, so that the same configuration applies to both command-line and Cloudera console deployments.

  • You have completed the steps in External vault requirements for Secret Service.
  • You have your Vault server address, bootstrap token, and the vault-ca.pem certificate file.
  • You have kubectl and helm command-line interface (CLI) access to the awc-core namespace.
  • The features.crossCluster parameter is enabled on your cluster. Secret Service requires features.crossCluster to function, and Cloudera recommends enabling it during cluster creation.
  • Your Vault server is reachable, unsealed, and supports the Key/Value (KV) v2 secrets engine, JSON Web Token (JWT) authentication, and Access Control List (ACL) policies.
  1. Retrieve the installed anywhere-cloud chart version by running the following command:
    helm get metadata anywhere-cloud -n awc-core
  2. Secret Service is enabled by default. If you turned it off, re-enable it by retrieving your current values file and passing it to the upgrade command.

    Retrieve your current values file by running the following command:

    helm get values <release-name> -n awc-core -o yaml > <current-values-file>

    Re-enable Secret Service by running the upgrade with your values file:

    helm upgrade <release-name> \
      oci://<chart-registry>/cloudera-helm/awc-core/anywhere-cloud --version <chart-version> \
      -n awc-core -f <current-values-file> \
      --set secretService.enabled=true
  3. Set the API base URL and an authenticated curl helper function.

    For a platform installation, authenticate through the platform gateway by using an administrator bearer token:

    HOST=https://console.<your-console-domain>
    JWT=<admin-bearer-token>
    awc() { curl -s -H "Authorization: Bearer $JWT" "$@"; }   # Add -k only for a self-signed gateway certificate
    BASE="$HOST/api/v1/secret-service"
  4. Build the JSON request body by running the following command:

    Pass the CA certificate as raw PEM into the ca_pem field, and add "namespace": "<vault-namespace>" under vault if your Vault server uses namespaces.

    jq -n --rawfile ca vault-ca.pem \
     '{type:"vault", vault:{
     address:"https://<vault-address>",
     admin_token:"<one-time-admin-token>",
     ca_pem:$ca}}' > /tmp/backend.json

    If the Vault certificate chains to a publicly trusted CA, omit both the --rawfile ca argument and the ca_pem:$ca line so that system root certificates are used and Transport Layer Security (TLS) verification remains enabled.

  5. Run the read-only prechecks by running the following command:

    This request makes no changes and returns "ok": true when successful.

    awc -X POST "$BASE/config/backend/test" -H "Content-Type: application/json" -d @/tmp/backend.json
  6. Onboard the Vault backend by running the following command:
    awc -X PUT "$BASE/config/backend" -H "Content-Type: application/json" -d @/tmp/backend.json
  7. Confirm that the backend is configured by running the following command:

    The response returns "state": "CONFIGURED".

    awc "$BASE/config/status"
  8. Remove the temporary request body file that contains the administrator token by running the following command:
    rm -f /tmp/backend.json

Secret Service is enabled on your Cloudera Anywhere Cloud cluster and connected to your external HashiCorp Vault backend.