Skip to content

Instantly share code, notes, and snippets.

@dkavanagh
Last active July 20, 2016 18:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dkavanagh/0945573dc13f1328ca72 to your computer and use it in GitHub Desktop.
Save dkavanagh/0945573dc13f1328ca72 to your computer and use it in GitHub Desktop.
This script generates a self-signed SSL cert and creates a Eucalyptus Management Console deployment using it (with ELB and AS services). It pulls in a CloudFormations template as well https://gist.github.com/dkavanagh/8cc932f0688b909547fe
#!/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.githubusercontent.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