Last active
October 8, 2024 03:39
-
-
Save mazenovi/db8e8efb001d45059a6102fa4e241688 to your computer and use it in GitHub Desktop.
explore recursively your vault by HashiCorp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function walk() { | |
for secret in $(vault list $1 | tail -n +3) | |
do | |
if [[ ${secret} == *"/" ]] ; then | |
walk "${1}${secret}" | |
else | |
echo "${1}${secret}" | |
fi | |
done | |
} | |
query="${1}" | |
if [[ ${query} != *"/" ]] ; then | |
query=${query}/ | |
fi | |
echo "${1}" | |
walk ${query} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you come across a (versioned) vault kv2 store you need to tweak the script a bit: