Skip to main content

A simple search and replace command line utility for Hashicorp Vault

Project description

vault-search-replace

Simple Python Script to Search (and replace) secrets content in hashicorp vault.

Rationale

Recently, I have come across the fact that no API allows to simply search for values within secrets. The specific use case I am working on is to change database connection strings for java based microservices.

Running the script

Best option is to install uv and run the script with:

uv run vault_search_replace.py

The script has inline metadata and will run without installation.

Usage

vault_search_replace.py [OPTIONS] 
                      STRING_TO_SEARCH 
                      VAULT_NAMESPACE
                      VAULT_BASE_URL 
                      VAULT_ACCESS_TOKEN
                      [REPLACEMENT_STRING]

Command Line Parameters:

Required:

string_to_search vault_namespace vault_base_url vault_access_token

Optional

string_to_replace

Options

--no-dry-run - confirm the execution

Without the (optional) replace_string argument, the command will execute a (string) search for search_string. With the replace argument, the command will execute a dry-run of the replace operation (no change will be applied). To force the creation of new secrets versions, the --no-dry-run option has to be passed.

As of this release, the search is very simple (python str.find function).

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

vault_search_replace-0.1.2.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

vault_search_replace-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file vault_search_replace-0.1.2.tar.gz.

File metadata

File hashes

Hashes for vault_search_replace-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2750dc96fd983a30ee79da2507d08bd766895ddb9ac0da06787572c84d84eb1b
MD5 b6078d9f50118dce163951c7a6cf16a6
BLAKE2b-256 fa3e38e088dd5cc8a3f520ef4d64ac18a4812d9a4dc13371179938e76600db29

See more details on using hashes here.

File details

Details for the file vault_search_replace-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for vault_search_replace-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ed726926121afc4b18c086cd03fdb7abf3b821934575780c8d5e394d79f781f3
MD5 79ed5dc8660685313ffc9d3d6c060c18
BLAKE2b-256 43bf46b7593cdfa3e368d0c75ff2cd2edca14f57baeb1c5aae8284439ed78a60

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