Skip to content

Helper to explorer a vault namespace base on search criteria

Notifications You must be signed in to change notification settings

MerzoukeMansouri/vault-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Vault Secret Search Script

This script searches for a specific secret within a given Vault namespace, dynamically displaying the results and tracking the time elapsed. It is designed to work efficiently with recursive paths and outputs clear, formatted results in real-time.

Features

  • Recursive Search: Searches all secrets in a given namespace, including sub-paths.
  • Real-time Updates: Displays progress dynamically, updating the results in real-time.
  • Elapsed Time: Shows the total time taken for the search once completed.
  • Formatted Output: Highlights found secrets in green and displays total results at the end.

Prerequisites

  • Vault CLI: Ensure the Vault CLI is installed and configured on your system.

  • Authentication: Your Vault token should be available in ~/.vault-token.

  • Dependencies: The script relies on vault and jq for JSON parsing. Install it with:

    brew install vault jq          # macOS
    sudo apt-get install vault jq  # Debian/Ubuntu

Usage

Run the script with the following syntax:

./vault.sh <search_secret> <vault_namespace>

Parameters

  • <search_secret>: The term to search for within the secret data.
  • <vault_namespace>: The Vault namespace path where the search should begin.

Example

./vault.sh <insert_your_secret> adeo/<insert_your_namespace>/secret/

Output

  • The script dynamically shows the current secret being inspected.
  • Displays found secrets in real-time.
  • Outputs the total number of secrets found and the time taken at the end.

Notes

  • Ensure your Vault token has the necessary permissions to read secrets in the specified namespace.
  • The script clears the terminal during execution to provide a clean, updated display.

Troubleshooting

  1. "Command not found" errors: Ensure vault and jq are installed and accessible in your PATH.

  2. Authentication issues: Make sure to authenticate with vault cli; I recommand you using this alias

    alias vault-me="vault login -method=oidc -namespace=<your-name-space> -address=https://vault.factory.adeo.cloud; cat ~/.vault-token | pbcopy;"
  3. Permission denied: Ensure your token has the correct policies for the namespace you're searching.

About

Helper to explorer a vault namespace base on search criteria

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages