Last active
May 11, 2021 20:29
-
-
Save pezhore/209a769920b917de191822ae8bee8984 to your computer and use it in GitHub Desktop.
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
# 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 '.data.data | to_entries | .[] | .key + "=" + .value' | while read i; do | |
export "$i" | |
done | |
unset PW |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
vault-integration.sh