Skip to content

Instantly share code, notes, and snippets.

@ccassler
Forked from dkavanagh/deploy-console.sh
Last active August 29, 2015 14:23
Show Gist options
  • Save ccassler/5c4fad9d60c110da4982 to your computer and use it in GitHub Desktop.
Save ccassler/5c4fad9d60c110da4982 to your computer and use it in GitHub Desktop.

Revisions

  1. @dkavanagh dkavanagh revised this gist Jan 23, 2015. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion deploy-console.sh
    Original file line number Diff line number Diff line change
    @@ -47,4 +47,8 @@ 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
    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
  2. @dkavanagh dkavanagh revised this gist Jan 23, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion deploy-console.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    #!/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
    @@ -42,4 +47,4 @@ 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=emi-bc44e9e6 -p KeyName=dak-ssh-key -p InstanceType=m1.medium -p SSLCertArn=$CERT_ARN
    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
  3. @dkavanagh dkavanagh created this gist Jan 22, 2015.
    45 changes: 45 additions & 0 deletions deploy-console.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    #!/bin/bash
    # 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=emi-bc44e9e6 -p KeyName=dak-ssh-key -p InstanceType=m1.medium -p SSLCertArn=$CERT_ARN