Obfuscate your secrets and store them in the vault of your choice (AWS, Azure, GCP, or HashiCorp Vault).
Done correctly, and utilizing dotenvx variable expansion,
there should only be one .env file throughout all environments.
Prerequisites:
- Python 3.12+
- UV Python package manager
- A supported cloud SDK or credentials for your provider (AWS, Azure, GCP, or Vault)
Install (recommended: virtual environment)
# For editable install during development:
uv pip install -e .Run the CLI directly from the project using the cli script:
obfu <command> [options]Generate a secret locally:
obfu generate -l 24Generate and store into the default cloud (default: aws):
obfu --cloud aws genstore my/secret/key -l 32Store a text secret:
obfu --cloud aws --tags='{"owner": "$USER"}' --prefix $(basename $PWD) store key
2026-01-08 13:27:17,359 - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2026-01-08 13:27:17,460 - INFO - Found endpoint for secretsmanager via: config_global.
2026-01-08 13:27:17,480 - INFO - Secret stored using key: obfu/keyStore a file based secret:
obfu --cloud aws --tags='{"owner": "$USER"}' --prefix $(basename $PWD) store key
Enter secret:
2026-01-09 16:06:50,375 - INFO - Found credentials in shared credentials file: ~/.aws/credentialsView metadata of a secret:
obfu --cloud aws --prefix $(basename $PWD) view key
2026-01-08 13:20:41,122 - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2026-01-08 13:20:41,222 - INFO - Found endpoint for secretsmanager via: config_global.
2026-01-08 13:20:41,253 - INFO - Path: obfu/key
2026-01-08 13:20:41,253 - INFO - Secret: ********
2026-01-08 13:20:41,253 - INFO - Tags: ['owner=dpeng']
2026-01-08 13:20:41,253 - INFO - Arn: arn:aws:secretsmanager:us-east-1:000000000000:secret:obfu/key-IOaodH
2026-01-08 13:20:41,253 - INFO - Version: {'1cc03a83-49fa-49a5-b6cf-b0e41fef22ce': ['AWSCURRENT']}
2026-01-08 13:20:41,253 - INFO - Updated_at: 2026-01-08 13:20:20.716572-08:00
2026-01-08 13:20:41,253 - INFO - Created_at: 2026-01-08 13:20:20.716572-08:00
2026-01-08 13:20:41,253 - INFO - Kms_id: NoneView the actual secret:
obfu --cloud aws --prefix $(basename $PWD) view key --show- Azure: supply
--kv-nameor set theKEY_VAULT_NAMEenv var. - GCP: supply
--project-idor setCLOUDSDK_CORE_PROJECT/GOOGLE_CLOUD_PROJECT. - Vault: supply
--vault-tokenor setVAULT_TOKEN. Use--vault-addror setVAULT_ADDRto change the server address. - AWS: you can set KMS key via
--kms-key-idor theKMS_KEY_IDenv var; tags are supported with--tags.
--prefix: Prefix to pad onto the key/path--tags: Tags to associate with the secret (when supported)--force: Forstore, force overwrite if the secret already exists
Store given secret into AWS Secrets Manager:
~/obfu/examples/dotenvx | on main ?12 obfu store obfu/my_secret
Enter secret:
2026-01-14 10:49:00,544 - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2026-01-14 10:49:00,698 - INFO - Found endpoint for secretsmanager via: config_global.Retrieve secret via environment variable injection on Docker:
~/obfu/examples/dotenvx | on main !3 ./docker.sh
[dotenvx@1.51.4] injecting env (0) from .env
ASM_SECRET shhh
ASM_API_KEY 123-123-123-123- Pass Secrets Manager secrets through Amazon ECS environment variables
- Pass Systems Manager parameters through Amazon ECS environment variables
- Using the AWS Secrets Manager Agent
This project is licensed under the GNU Lesser General Public License v2.1 - see the LICENSE file for details.