Created
January 26, 2015 07:24
-
-
Save antho1404/e0f80fae41cdb77b5582 to your computer and use it in GitHub Desktop.
generate a ssl certificate, combine it and add it to a heroku app
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
if [ $1 = "create" ] | |
then | |
brew update | |
brew upgrade openssl | |
openssl genrsa -des3 -out server.pass.key 2048 | |
openssl rsa -in server.pass.key -out server.key | |
openssl req -nodes -new -key server.key -out server.csr | |
echo '' | |
cat server.csr | |
cat server.csr | pbcopy | |
echo '' | |
echo '=======================================' | |
echo 'Paste this key to configure your certificate in your Godaddy or whatever account (already in your clipboard ;) )' | |
echo '=======================================' | |
fi | |
if [ $1 = "publish" ] | |
then | |
crt=$2 | |
bundle=$3 | |
echo "Combine cerfificates" | |
cat $crt $bundle > combined.crt | |
echo "Choose your heroku app" | |
read app | |
status=$(heroku apps | grep -E "$app( |$)") | |
if [ $? -ne 0 ] | |
then | |
heroku apps:create $app | |
fi | |
heroku addons:add ssl:endpoint -a $app | |
heroku certs:add combined.crt server.key -a $app | |
heroku certs -a $app | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment