Created
February 27, 2017 02:01
-
-
Save anonymous/945719cef2764449836a08bd5791af4b 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
#!/usr/bin/env bash | |
# | |
# | |
# 2017-02-26 7:01 PM | |
# | |
# Bash "strict mode header". | |
IFS=$'\n\t' | |
set -euo pipefail | |
# Path to this script. | |
SCRIPT_NAME=$(basename ${BASH_SOURCE[0]}) | |
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
# Script | |
TEMPFILE=$(mktemp) | |
BASE64KEY=$( | |
aws kms decrypt \ | |
--region us-east-1 \ | |
--encryption-context 'KeyType=Chef Service Discovery' \ | |
--ciphertext-blob fileb:///foreflight/discovery-v2.encrypted-key \ | |
--output text \ | |
--query Plaintext | |
) | |
KEY=$(echo ${BASE64KEY} | base64 -d) | |
openssl enc -d -aes-256-cbc -k "${KEY}" -base64 -in /foreflight/discovery-v2.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment