Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Manage KMS using the CLI

Configure Key Management System integrations, rewrap filesystem keys, and prepare Vault or KMIP using the CLI.

Configure the KMS

Connects the cluster to a key management service for filesystem encryption. The KMS type is a subcommand, and each type takes its own options.

Command: weka security kms set vault

weka security kms set vault <address> <key-name> [--auth-path <string>] [--convert-to-cluster-key-on-fs] [--kubernetes-role <string>] [--namespace <string>] [--network-space-id <uint16>] [--role-id <string>] [--secret-id <string>] [--token <string>] [--transit-path <string>]

Command: weka security kms set kmip

weka security kms set kmip <address> <key-identifier> --client-cert <string> --client-key <string> [--ca-cert <string>] [--convert-to-cluster-key-on-fs] [--network-space-id <uint16>]

Parameters

Parameter
Description

address*

Server address, usually a hostname:port or URL. Values: URL for vault hostname:port for kmip

key-name*

Key name to secure the filesystems.

--auth-path <string>

Custom auth path URL prefix.

--convert-to-cluster-key-on-fs

Convert all encrypted filesystems to use the cluster key.

--kubernetes-role <string>

Kubernetes role for Vault authentication.

--namespace <string>

Namespace in the Vault.

--network-space-id <uint16>

Network space ID in which to run the KMS connector. Defaults to the host network namespace.

--role-id <string>

Role ID to access the KMS.

--secret-id <string>

Secret ID to access the KMS (required with --role-id).

--token <string>

API token to access the KMS.

--transit-path <string>

Custom transit path URL prefix.

key-identifier*

Key UID to secure the filesystems with.

--client-cert <string>*

Path to the client certificate PEM file.

--client-key <string>*

Path to the client key PEM file.

--ca-cert <string>

Path to a CA certificate PEM file for the KMIP server.

Obtain role-id and secret-id from HashiCorp Vault

Use this procedure when configuring HashiCorp Vault with AppRole authentication. This method is required for per-filesystem encryption and is an option for cluster-wide encryption. The Vault administrator provides the role-id and secret-id needed for access.

Recommendation: use batch tokens for per-filesystem encryption

For per-filesystem encryption, it is recommended to configure the AppRole with batch tokens to ensure optimal performance and scalability in your HashiCorp Vault environment.

Unlike standard service tokens, which generate a new lease for each authentication request, batch tokens are designed for high-volume, automated workflows. They do not create new leases upon use, which is critical for maintaining efficiency in environments with many filesystems.

While batch tokens can be used multiple times, their lifetime is limited by a Time-to-Live (TTL). It is recommended to set a short TTL (for example, 20 minutes) to align with security best practices.

Batch tokens are not single-use but are limited by their TTL, and they do not create new leases upon use, which prevents this scalability problem. To implement this, create your AppRole with the token_type set to batch.

For more information, refer to the official HashiCorp Vault documentation.

Set up roles for cluster access

Enable AppRole authentication:

Role for cluster:

Retrieve the role-id:

Role for Key1:

Retrieve the role-id and generate a secret-id:

Examples

Setting the system with a HashiCorp Vault KMS for cluster-wide encryption:

Setting the system with a HashiCorp Vault KMS for per-filesystem encryption:

Setting the system with a KMIP complaint KMS (SmartKey example):

View the KMS configuration

Shows the configured KMS type, address, and key identifier.

Command: weka security kms

Remove the KMS configuration

Disconnects the cluster from its KMS.

Command: weka security kms reset

Parameters

Parameter
Description

--allow-downgrade

Allow downgrading encrypted filesystems to local encryption instead of a KMS.

-f, --force

For tenant KMS deletion, switch filesystems to the cluster-wide KMS. Requires cluster KMS to exist.

Rewrap filesystem keys

Re-encrypts filesystem keys with the current KMS master key, after the master key has been rotated.

Command: weka security kms rewrap

Parameters

Parameter
Description

--all

Rewrap all filesystem keys.

--convert-to-cluster-key-on-fs

Convert all encrypted filesystems to use the cluster key.

-f, --force

Force action. Perform this action without further confirmation.

--new-key-uid <string>

Unique identifier for the new key to wrap filesystem keys with. KMIP only.

WEKA does not automatically re-encrypt existing filesystem keys with the new KMS key for snapshots that were previously uploaded with the old encrypted keys.

Set up vault configuration

Enable 'Transit' secret engine in vault

The system uses encryption-as-a-service capabilities of the KMS to encrypt/decrypt the filesystem keys. This requires the configuration of Vault with the transit secret engine with this command:

The expected output is:

Set up a master key for the WEKA system

Once the transit secret engine is set up, a master key for use with the system must be created with this command:

The expected output is:

It is possible to either create a different key for each WEKA cluster or to share the key between different WEKA clusters.

Related information:

Vault transit secret-engine documentation

Create a policy for master key permissions

  • Create a weka_policy.hcl file with the following content:

This limits the capabilities so there is no permission to destroy the key, using this policy. This protection is important when creating an API token.

  • Create the policy using the following command:

Obtain an API token from the vault

Authentication from the system to Vault relies on an API token. Since the system must always be able to communicate with the KMS, a periodic service token must be used.

  • Verify that thetoken authentication method in Vault is enabled. This can be performed using the following command:

The expected output is:

  • To enable the token authentication method use the following command:

  • Log into the KMS system using any of the identity methods Vault supports. The identity must have permission to use the previously set master key.

  • Create a token role for the identity using the following command:

The period is the designated timeframe for a renewal request. If a renewal is not requested within this period, the token is revoked, necessitating the retrieval of a new token from the Vault and its configuration in the system.

  • Generate a token for the logged-in identity using the following command:

The expected output is:

For more information on obtaining an API token, refer to Vault Tokens documentation.

Obtain a certificate for a KMIP-based KMS

Each KMS employs a unique process for obtaining a client certificate and key and configuring it through the KMS. The certificate is generated using OpenSSL and utilizes a UID obtained from the KMS.

Example:

Refer to the specific KMS documentation to create a certificate and associate it with the WEKA cluster within the KMS, ensuring it has the necessary privileges for encryption and decryption.

Last updated