-
-
Save ccassler/5c4fad9d60c110da4982 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| # params passed to cloud formation template | |
| CLOUD_IP=10.111.5.150 | |
| SSH_KEY=dak-ssh-key | |
| IMAGE_ID=emi-bc44e9e6 | |
| # create a self-signed ssl cert and install it via IAM | |
| C=US | |
| ST=CA | |
| L="Santa Barbara" | |
| O=Eucalyptus | |
| OU=Eucalyptus | |
| HOST=${1:-`hostname`} | |
| DATE=`date '+%Y%m%d'` | |
| CN='Console Cert' | |
| openssl genrsa 2048 -out > ca.key | |
| openssl req -new -key ca.key -out ca.csr << EOF | |
| ${C} | |
| ${ST} | |
| ${L} | |
| ${O} | |
| ${OU} | |
| ${CN} | |
| $USER@${CN} | |
| . | |
| . | |
| EOF | |
| openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt | |
| openssl genrsa 2048 -out > console-ssl-pk.pem | |
| openssl req -sha256 -new -key console-ssl-pk.pem -out console-ssl.csr << EOF | |
| ${C} | |
| ${ST} | |
| ${L} | |
| ${O} | |
| ${OU} | |
| ${CN} | |
| $USER@${CN} | |
| . | |
| . | |
| EOF | |
| openssl x509 -req -days 7300 -in console-ssl.csr -CA ca.crt -CAkey ca.key -out console-ssl.crt -set_serial 02 | |
| euare-servercertupload -s consolecert --private-key-file console-ssl-pk.pem --certificate-file console-ssl.crt | |
| CERT_ARN=`euare-servercertgetattributes -s consolecert |head -1` | |
| # fetch deploy template and create a stack | |
| curl https://gist.github.com/dkavanagh/8cc932f0688b909547fe/raw/eucaconsole-template.json > eucaconsole-template.json | |
| euform-create-stack --template-file eucaconsole-template.json console-stack -p ImageId=$IMAGE_ID -p KeyName=$SSH_KEY -p InstanceType=m1.medium -p SSLCertArn=$CERT_ARN -p CloudIP=$CLOUD_IP | |
| # cleanup | |
| rm -f ca.crt ca.csr ca.key console-ssl.crt console-ssl.csr console-ssl-pk.pem | |
| rm eucaconsole-template.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment