Skip to main content

A Python package providing helper function to dynamically retrieve secrets & their values from cloud platforms like Azure or AWS.

Project description

SecretsManager

A Python package providing helper function to dynamically retrieve secrets & their values from cloud platforms like Azure or AWS.

Features

  • Connects to Azure Key Vault or AWS Secrets Manager client.
  • Retrieves the list of all the secrets & their respective values.
  • Handles authentication using Azure AD DefaultAzureCredential for Azure and boto3 library for connecting to the AWS Session client.
  • Returns a dictionary, with key-value pairs of all the secrets & their valies.

Installation

Install via PyPI once published:

pip install SecretsManager

Usage

Retrieving the secrets from Azure/AWS

from SecretsManager import get_secrets

# Your connection info
conn_point = "Azure" or "AWS
azure_vault_url = "https://your-vault-url.vault.azure.net/"
aws_secret_name = "your-aws-secret-name"
aws_region = "your-aws-region-name"

# call the function with the paramets
result = get_secrets(conn_point, azure_vault_url, aws_secret_name, aws_region)
print(result)

# Example usage :
key_value = result["key_name"]

Prerequisites

  • For Azure:

    • Azure environment or VM's Managed Identity configured for Azure authentication.
    • Azure Key Vault set up in the same subscription in which the VM is created.
    • Appropriate IAM Role assignments to be provided to the Key Vault, wherein VM's Managed Identity is to be given the key-vault-secrets-user role, so that it has the read access for the contents of the secrets.
    • azure-identity Python package installed for DefaultAzureCredential support.
    • give it some time (~2-3mins) to propagate these permissions.
    • [Follow this link for step-by-step configuration details]
  • For AWS:

    • AWS environment or EC2 Instance(VM) configured for AWS authentication.
    • Create an IAM Role having the permission for SecretsManagerReadWrite, that would provide proper access.
    • Assign this AWS IAM role to the security of the EC2 Instance(VM), that would give the EC2 Instance the access to retrieve all the secrets.
    • boto3 Python package installed for AWS Session client connection support.
    • [Follow this link for step-by-step configuration details]
pip install azure-identity azure-keyvault-secrets boto3

License

This project is licensed under the MIT License - see the [LICENSE] (LICENSE) file for details.

Contributing

Feel free to open issues or submit pull requests to improve the package.

Author

Antick Mazumder — antick.majumder@gmail.com

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

secretsservicemanager-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

secretsservicemanager-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file secretsservicemanager-0.1.1.tar.gz.

File metadata

  • Download URL: secretsservicemanager-0.1.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.1

File hashes

Hashes for secretsservicemanager-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2eb2cae3ebf39b79df6c027e7f742af7bd60882b3418f1c7089559a12853aec9
MD5 d023497534adeb5af78a3e30e1722168
BLAKE2b-256 9c489c7c0d9358261b8af12d5d78166e509304701981c0a0218d32df98ce668a

See more details on using hashes here.

File details

Details for the file secretsservicemanager-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for secretsservicemanager-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b48b890f6adc748bee1c3a51fa1c57dd926186d69a41f593b994da69b5b662cc
MD5 9092e3ce68ba6d5a4b9b02e4caf11286
BLAKE2b-256 b76ed781074ca70b1d97d17f588899a5e8a3467ae71c9ec05a457735ecc85868

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