Last active
December 28, 2015 08:39
-
-
Save eikenb/7472895 to your computer and use it in GitHub Desktop.
script to create/encrypt credentials for dispensing
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
#!/bin/sh | |
# Set apid-cli up, copy this file somewhere and edit the CLUSTERS to match your | |
# apid-cli config file (~/.janrain-capture at the time of writing). | |
CLUSTERS="test us eu au" | |
usage() { | |
[ -n "$1" ] && echo "ERROR: $1\n" | |
echo "Usage: `basename $0` USERNAME PASSPHRASE" | |
echo "\tUSERNAME - should match [USERNAME]@janrain.com" | |
echo "\tPASSPHRASE - passphrase used with gpg encryption" | |
echo | |
echo "Run this to generate pgp file, then email it to them, and give them" | |
echo "the passphrase via IM or something (not in same email as gpg file)." | |
exit 1 | |
} | |
name=$1 | |
passphrase=$2 | |
[ -z $name ] && usage 'missing name argument' | |
[ -z $passphrase ] && usage 'misisng passpharse argument' | |
for env in $CLUSTERS ; do | |
echo ---- $env ---- | |
apid-cli -c $env gca $name '["admin"]' \ | |
| grep client_ | sed 's/^\ \+\|[",]//g' | |
done | gpg --passphrase "${passphrase}" --no-use-agent --symmetric \ | |
--output ${name}.txt.gpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment