AWS KMS Encryption
Protect Secrets Manager connection details with AWS KMS

Keeper Secrets Manager integrates with AWS KMS in order to provide encryption for Keeper Secrets Manager configuration files. With this integration, you can protect connection details on your machine while taking advantage of Keeper's zero-knowledge encryption of all your secret credentials.
Looking for AWS Secrets Manager-backed storage instead? See AWS Secrets Manager Storage. That integration stores the KSM config inside an AWS Secrets Manager secret, with no local file. The two AWS integrations solve different problems and use different AWS services; pick the one that fits your deployment shape.
Features
Encrypt and Decrypt your Keeper Secrets Manager configuration files with AWS KMS
Protect against unauthorized access to your Secrets Manager connections
Requires only minor changes to code for immediate protection. Works with all Keeper Secrets Manager SDK functionality
Prerequisites
Supports the Java Secrets Manager SDK
Supports Java 11 and above
Supports the JavaScript Secrets Manager SDK
@aws-sdk/client-kmsis bundled — no separate install required
Supports the Python Secrets Manager SDK
Requires Python 3.9.2+ (pin to
<1.1.0for Python 3.6–3.8)Requires boto3 package
Supports the .Net Secrets Manager SDK
Requires AWSSDK.KeyManagementService
Setup
1. Install Module
Setting up project using Gradle or Maven
Gradle
Maven
The Secrets Manager AWS Key Management Service Integration can be installed using npm
The Secrets Manager AWS KMS storage module can be installed using pip
boto3 is a prerequisite for the AWS KSM integration. Install it to your machine using pip.
The Secrets Manager AWS Key Management Service Integration can be installed using
2. Configure AWS Connection
By default, the AWS SDK will utilize the default connection session setup with the AWS CLI using the aws configure command. If you would like to specify the connection details, the two configuration files located at ~/.aws/config and ~/.aws/credentials can be manually edited.
See the AWS documentation for more information on setting up an AWS session: https://docs.aws.amazon.com/cli/latest/reference/configure/
Alternatively, configuration variables can be provided explicitly using the AwsSessionConfig data class and providing aws_access_key_id, aws_secret_access_key, and region_name variables.
You will need an AWS Access Key to use the AWS KMS integration.
For more information on AWS Access Keys see the AWS documentation: https://aws.amazon.com/premiumsupport/knowledge-center/create-access-key/
3. Add AWS KMS Storage to Your Code
Once the AWS connection has been configured, you can use AWS KMS to encrypt and decrypt KSM configurations. Tell the Secrets Manager SDK to utilize KMS as storage. Using Specified Connection credentials
To do this, use AwsKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, AwsSessionConfig, as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
To do this, use AWSKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, AWS Session credentials - AWSSessionConfig , as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
To do this, use AwsKmsKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, AwsSessionConfig, as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
Upgrading from v1.0.x? v1.1.0 includes these behavioral changes:
decrypt_config()now defaults toautosave=False— calldecrypt_config(autosave=True)to preserve the previous behavior.Encrypt and decrypt failures now raise exceptions instead of silently corrupting storage state.
Corrupt or non-UTF8 config files now raise
"is not a valid encrypted config file"instead of leakingJSONDecodeErroror logging silently.Config writes are now atomic (write-then-rename), so a failed write no longer truncates the existing config to zero bytes.
delete_all()now removes the encrypted config file from disk instead of writing an empty encrypted blob.AwsKmsKeyValueStorageis now thread-safe for concurrent reads and writes.
To do this, use AWSKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, AwsSessionConfig, as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
Using Default Connection
To do this, use AwsKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
To do this, use AWSKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID , as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
To do this, use AwsKmsKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
To do this, use AWSKeyValueStorage as your Secrets Manager storage in the SecretsManager constructor.
The storage will require an AWS Key ID, as well as the name of the Secrets Manager configuration file which will be encrypted by AWS KMS.
Using the AWS KMS Integration
Once setup, the Secrets Manager AWS KMS integration supports all Secrets Manager SDK functionality. Your code will need to be able to access the AWS KMS APIs in order to manage the decryption of the configuration file when run.
Additional Options
Change Key
We can change key that is used for encrypting the configuration, examples below show the code needed to use it
Decrypt Config
We can decrypt the config if current implementation is to be migrated onto a different cloud or if you want your raw credentials back. The function accepts a boolean which when set to true will save the decrypted configuration to file and if left false, will just return decrypted configuration.
v1.1.0: decrypt_config() now defaults to autosave=False. Previously the default was True, which would overwrite the encrypted config file with plaintext. Pass autosave=True explicitly to save to disk.
You're ready to use the KSM integration 👍
Check out the KSM SDKs documentation for more examples and functionality
Last updated

