Skip to content

Instantly share code, notes, and snippets.

@rgevaert
Created January 6, 2021 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgevaert/ac58b8a43427a66af56be70f810edd5c to your computer and use it in GitHub Desktop.
Save rgevaert/ac58b8a43427a66af56be70f810edd5c to your computer and use it in GitHub Desktop.
Simple wrapper script to unseal a vault server with encrypted seal keys
#!/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