Skip to content

Instantly share code, notes, and snippets.

@pirj
Created May 30, 2016 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirj/51798f23cedc4efce49a067b3ab385de to your computer and use it in GitHub Desktop.
Save pirj/51798f23cedc4efce49a067b3ab385de to your computer and use it in GitHub Desktop.
Generate self-signed certificate
# https://devcenter.heroku.com/articles/ssl-certificate-self
[ -z "$1" ] && echo provide file name as argument e.g. self-signed.sh server && exit 1
openssl genrsa -des3 -passout pass:x -out $1.pass.key 2048
openssl rsa -passin pass:x -in $1.pass.key -out $1.key
rm $1.pass.key
openssl req -new -key $1.key -out $1.csr
openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt
cat $1.key $1.crt > $1.pem
rm $1.key $1.crt $1.csr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment