Skip to content

Instantly share code, notes, and snippets.

@stand-sure
Created April 24, 2025 19:13
Show Gist options
  • Save stand-sure/dd82727c131cd6b79068d7f6b240a1b5 to your computer and use it in GitHub Desktop.
Save stand-sure/dd82727c131cd6b79068d7f6b240a1b5 to your computer and use it in GitHub Desktop.
script to get and decode vault unseal keys (bankvaults)
#!/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