Skip to main content

Keeper Secrets Manager SDK storage integration with Google Cloud KMS for encrypted key-value storage.

Project description

GCP KSM

Keeper Secrets Manager integrates with GCP KMS in order to provide protection 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.

Features

  • Encrypt and Decrypt your Keeper Secrets Manager configuration files with GCP 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 Python SDK functionality

Prerequisites

  • Supports the Python Secrets Manager SDK
  • Requires google-cloud-kms package
  • These are permissions required for service account:
    • Cloud KMS CryptoKey Decrypter
    • Cloud KMS CryptoKey Encrypter
    • Cloud KMS CryptoKey Public Key Viewer

Setup

  1. Install KSM Storage Module

The Secrets Manager GCP KSM module can be installed using pip

pip3 install keeper-secrets-manager-storage

  1. Configure GCP Connection

By default the google-cloud-kms library will utilize the default connection session setup with the GCP CLI with the gcloud auth command. If you would like to specify the connection details, the two configuration files located at ~/.config/gcloud/configurations/config_default and ~/.config/gcloud/legacy_credentials//adc.json can be manually edited.

See the GCP documentation for more information on setting up an GCP session: https://cloud.google.com/sdk/gcloud/reference/auth

Alternatively, configuration variables can be provided explicitly as a service account file using the GcpSessionConfig data class and providing a path to the service account json file.

You will need a GCP service account to use the GCP KMS integration.

For more information on GCP service accounts see the GCP documentation: https://cloud.google.com/iam/docs/service-accounts

  1. Add GCP KMS Storage to Your Code

Now that the GCP connection has been configured, you need to tell the Secrets Manager SDK to utilize the KMS as storage.

To do this, use GcpKmsKeyvalueStorage as your Secrets Manager storage in the SecretsManager constructor.

The storage will require a GCP Key ID, as well as the name of the Secrets Manager configuration file which will be encrypted by GCP KMS.

    from keeper_secrets_manager_storage.storage_gcp_kms import GCPKeyConfig, GCPKeyValueStorage,GCPKMSClientConfig

    from keeper_secrets_manager_core import SecretsManager

    # example key : projects/<project>/locations/<location>/keyRings/<key>/cryptoKeys/<key_name>/cryptoKeyVersions/<key_version>
    gcp_key_config_1 = GCPKeyConfig("<key_resource_uri_1>")
    gcp_key_config_2 = GCPKeyConfig("<key_resource_uri_1>")

    gcp_session_config = GCPKMSClientConfig().create_client_from_credentials_file('<gcp_credentials_config_file_location.json>')
    config_path = "<ksm_config.json>"
    one_time_token = "<token>"

    storage = GCPKeyValueStorage(config_path, gcp_key_config_1, gcp_session_config)
    storage.change_key(gcp_key_config_2) # if we want to change the key
    secrets_manager = SecretsManager(token=one_time_token,config=storage)
    all_records = secrets_manager.get_secrets()
    print(storage.decrypt_config(False))

    first_record = all_records[0]
    print(first_record)

You're ready to use the KSM integration 👍 Using the GCP KMS Integration

Once setup, the Secrets Manager GCP KMS integration supports all Secrets Manager Python SDK functionality. Your code will need to be able to access the GCP KMS APIs in order to manage the decryption of the configuration file when run.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file keeper_secrets_manager_storage_gcp_kms-1.0.0.tar.gz.

File metadata

File hashes

Hashes for keeper_secrets_manager_storage_gcp_kms-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ea4bbe91ce58fd32b85860fc90370549fdcbdd658d4b2b1dafbfcab513f0270b
MD5 f97645c0cdae12ce71da593c9539964f
BLAKE2b-256 65fae07f9ed75b005ebc70e5b87815ba2126ea3eda72ee7b0aa147d6d3ab652c

See more details on using hashes here.

File details

Details for the file keeper_secrets_manager_storage_gcp_kms-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for keeper_secrets_manager_storage_gcp_kms-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd7d150f5f6ec0272879008598f2481d004410b2e35009f2bc2f412defdf148b
MD5 c893ce0c70772fb1bfc05b6547aaaea5
BLAKE2b-256 c9bfde223ca17a9bf8f42fe8b0fd05feaf75fc44b8f95cae2833a6e7be8398d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page