Skip to content

Instantly share code, notes, and snippets.

Created February 27, 2017 02:01
Show Gist options
  • Save anonymous/945719cef2764449836a08bd5791af4b to your computer and use it in GitHub Desktop.
Save anonymous/945719cef2764449836a08bd5791af4b to your computer and use it in GitHub Desktop.
#!/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