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. After that you can run the script with

uv tool 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 always creates a new secret version. By default, it performs a dry-run—showing the changes without applying them. To actually apply the changes to the secrets, the --no-dry-run option must 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.2.0.tar.gz (15.0 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.2.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vault_search_replace-0.2.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vault_search_replace-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1c08c91964f1a7cc509aa5495c278b9b78d5c1fa2b7753ba05cd04c03bae3ddb
MD5 7a747f5ada40b302d9412a7c1b439747
BLAKE2b-256 22f1f55866df34b201a3230f206cc0d47006533386ae9f79c87b9a91e3487d69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vault_search_replace-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vault_search_replace-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a61377203a43e6f5db631d616c5866f4642e51e8a1fe60eed9a934a0fc01629c
MD5 97e7bc1608bb969a11158e6f2c08d828
BLAKE2b-256 3e1748ebe83e17611f5d8780651828c6a284cce8c7d6940f804bb42ef4b9e8a0

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