Skip to content
dpengftwPublic

About

Obfuscate your secrets and store them in the vault of your choice (AWS, Azure, GCP, or HashiCorp Vault).

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

obfu

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.

Quick-start

Prerequisites:

Install (recommended: virtual environment)

# For editable install during development:
uv pip install -e .

Run

Run the CLI directly from the project using the cli script:

obfu <command> [options]

Examples

Generate a secret locally:

obfu generate -l 24

Generate and store into the default cloud (default: aws):

obfu --cloud aws genstore my/secret/key -l 32

Store 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/key

Store 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/credentials

View 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: None

View the actual secret:

obfu --cloud aws --prefix $(basename $PWD) view key --show

Provider-specific notes

  • Azure: supply --kv-name or set the KEY_VAULT_NAME env var.
  • GCP: supply --project-id or set CLOUDSDK_CORE_PROJECT / GOOGLE_CLOUD_PROJECT.
  • Vault: supply --vault-token or set VAULT_TOKEN. Use --vault-addr or set VAULT_ADDR to change the server address.
  • AWS: you can set KMS key via --kms-key-id or the KMS_KEY_ID env var; tags are supported with --tags.

Common flags

  • --prefix : Prefix to pad onto the key/path
  • --tags : Tags to associate with the secret (when supported)
  • --force : For store, force overwrite if the secret already exists

Downstream use case

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

References

License

This project is licensed under the GNU Lesser General Public License v2.1 - see the LICENSE file for details.

About

Obfuscate your secrets and store them in the vault of your choice (AWS, Azure, GCP, or HashiCorp Vault).

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages