Manage KMS using the CLI
This page describes how to manage the Key Management System (KMS) using the CLI.
Using the CLI, you can:
Add or update the KMS
Command: weka security kms set
Use the following command line to add or update the Vault KMS configuration in the Weka system:
weka security kms set <type> <address> <key-identifier> [--token token] [--client-cert client-cert] [--client-key client-key] [--ca-cert ca-cert]
Parameters
Name | Type | Value | Limitations | Mandatory | Default |
| String | Type of the KMS | Either | Yes | |
| String | KMS server address |
| Yes | |
| String | Key to be used for encryption-as-a-service in the KMS | Key name (for Vault) or a key UID (for KMIP) | Yes | |
| String | API token to access Vault KMS | Must have:
| Must be supplied for | |
| String | Path to the client certificate PEM file | Must permit | Must be supplied for | |
| String | Path to the client key PEM file | Must be supplied for | ||
| String | Path to the CA certificate PEM file | Optional for |
Note: For the add/update command to succeed, the KMS should be preconfigured and available with the key and a valid token.
Example:
Setting the Weka system with a Vault KMS:
weka security kms set vault https://vault-dns:8200 weka-key --token s.nRucA9Gtb3yNVmLUK221234
Setting the Weka system with a KMIP complaint KMS (e.g., SmartKey):
weka security kms set kmip amer.smartkey.io:5696 b2f81234-c0f6-4d63-b5b3-84a82e231234 --client-cert smartkey_cert.pem --client-key smartkey_key.pem
View the KMS
Command: weka security kms
Use this command to show the details of the configured KMS.
Remove the KMS
Command: weka security kms unset
Use this command to remove the KMS from the Weka system. It is only possible to remove a KMS configuration if no encrypted filesystems exist.
Note: To force remove a KMS even if encrypted filesystems exist, use the --allow-downgrade
attribute. In such cases, the encrypted filesystem keys are re-encrypted with local encryption and may be compromised.
Re-wrap filesystem keys
Command: weka security kms rewrap
If the KMS key is compromised or requires rotation, the KMS admin can rotate the key in the KMS. In such cases, this command is used to re-encrypt the encrypted filesystem keys with the new KMS master key.
weka security kms rewrap [--new-key-uid new-key-uid]
Parameters
Name | Type | Value | Limitations | Mandatory | Default |
| String | Unique identifier for the new key to be used to wrap filesystem keys | Must be supplied for |
Note: Existing filesystem keys that are part of the Snap-To-Object feature will not be automatically re-encrypted with the new KMS key.
Note: Unlike in Vault KMS, re-wrapping a KMIP-based KMS requires generating a new key in the KMS, rather than rotating the same key. Hence, the old key should be preserved in the KMS in order to be able to decrypt old Snap2Obj snapshots.
Set up vault configuration
Enable 'Transit' secret engine in vault
The Weka 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.
For more information, refer to Vault transit secret-engine documentation.
Set up a master key for the Weka system
Once the transit
secret engine is set up, a master key for use with the Weka system must be created.
Note: It is possible to either create a different key for each Weka cluster or to share the key between different Weka clusters.
For more information, refer to 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 Weka system to Vault relies on an API token. Since the Weka system must always be able to communicate with the KMS, a periodic service token must be used.
Verify that the
token
authentication method in Vault is enabled. This can be performed using the following command:
To enable the token authentication method use the following command:
Log into the KMS system using any of the identity methods supported by Vault. The identity should have permission to use the previously-set master key.
Create a token role for the identity using the following command:
Note: The period
is the time set for a renewal request. If no renewal is requested during this time period, the token will be revoked and a new token must be retrieved from Vault and set in the Weka system.
Generate a token for the logged-in identity using the following command:
For more information on obtaining an API token, refer to Vault Tokens documentation.
Note: The Weka system does not automatically renew the API token lease. It can be renewed using the Vault CLI/API. It is also possible to define a higher maximum token value (max_lease_ttl)
by changing the Vault Configuration file.
Obtain a certificate for a KMIP-based KMS
The method for obtaining a client certificate and key and set it via the KMS is different for each KMS. The certificate itself is generated using OpenSSL, with a UID obtained from the KMS.
Example:
See the specific KMS documentation to create a certificate and link it to the Weka cluster in the KMS with sufficient privileges (encrypt/decrypt).
For example, for SmartKey KMS, follow similar instructions as suggested here to create a client certificate and key, and assign a certificate for Weka within SmartKey.
Last updated