Skip to content

Instantly share code, notes, and snippets.

Last active May 11, 2021
What would you like to do?
# This little bit of magic is great
# It will run a simple script that pulls vars from vault
echo -n "Vault Password: "
read -s PW
echo ""
LVT=$(curl -ks --request POST --data "{\"password\": \"$PW\"}" https://localhost:8200/v1/auth/userpass/login/pez | jq -r '.auth.client_token')
echo "LVT: [ $LVT ]"
curl -ks --header "X-Vault-Token: $LVT" https://localhost:8200/v1/kv/data/zshrc | jq -r ' | to_entries | .[] | .key + "=" + .value' | while read i; do
export "$i"
unset PW
Copy link

TheSp1der commented May 11, 2021

I have an updated POSIX compatible version that includes a but more sanity. It also addresses an issue with attempting to expose variables from within a while loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment