Created
January 6, 2021 10:44
-
-
Save rgevaert/ac58b8a43427a66af56be70f810edd5c to your computer and use it in GitHub Desktop.
Simple wrapper script to unseal a vault server with encrypted seal keys
This file contains hidden or 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
#!/bin/bash -e | |
# Simple wrapper script to unseal a vault server with encrypted seals | |
read -rp 'Decrypt method [keybase|gpg]: ' method | |
case "${method}" in | |
gpg) | |
cmd="gpg -dq" | |
;; | |
keybase) | |
cmd="keybase pgp decrypt" | |
;; | |
*) | |
echo "Only gpg or keybase are accepted" | |
exit 1; | |
;; | |
esac | |
read -rsp 'Encrypted unseal key: ' encrypted_seal | |
decrypted=$(echo "${encrypted_seal}" | base64 -d | ${cmd}) | |
read -rp 'Give vault addr, e.g. "https://vault.example.com:8200" : ' address | |
vault operator unseal -address="${address}" "${decrypted}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment