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
DefaultAzureCredentialfor Azure andboto3library 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-userrole, so that it has the read access for the contents of the secrets. azure-identityPython package installed forDefaultAzureCredentialsupport.- 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.
boto3Python 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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2eb2cae3ebf39b79df6c027e7f742af7bd60882b3418f1c7089559a12853aec9
|
|
| MD5 |
d023497534adeb5af78a3e30e1722168
|
|
| BLAKE2b-256 |
9c489c7c0d9358261b8af12d5d78166e509304701981c0a0218d32df98ce668a
|
File details
Details for the file secretsservicemanager-0.1.1-py3-none-any.whl.
File metadata
- Download URL: secretsservicemanager-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b48b890f6adc748bee1c3a51fa1c57dd926186d69a41f593b994da69b5b662cc
|
|
| MD5 |
9092e3ce68ba6d5a4b9b02e4caf11286
|
|
| BLAKE2b-256 |
b76ed781074ca70b1d97d17f588899a5e8a3467ae71c9ec05a457735ecc85868
|