Created
April 24, 2025 19:13
-
-
Save stand-sure/dd82727c131cd6b79068d7f6b240a1b5 to your computer and use it in GitHub Desktop.
script to get and decode vault unseal keys (bankvaults)
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
#!/usr/bin/env bash | |
BUCKET=abc/def | |
REGION=us-east-1 | |
PROFILE=my_profile | |
for key in "vault-root" "vault-unseal-0" "vault-unseal-1" "vault-unseal-2" "vault-unseal-3" "vault-unseal-4" | |
do | |
aws s3 cp s3://${BUCKET}/${key} . --profile "$PROFILE" --region "$REGION" | |
aws kms decrypt \ | |
--region ${REGION} \ | |
--profile ${PROFILE} \ | |
--ciphertext-blob fileb://${key} \ | |
--encryption-context Tool=bank-vaults \ | |
--output text \ | |
--query Plaintext | base64 -d > ${key}.txt | |
rm ${key} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment