-
-
Save sjoorm/4f6ff7d7bc3f61fc90b0 to your computer and use it in GitHub Desktop.
SSL certificate generator
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 | |
name= | |
if [ -z "$1" ] | |
then | |
name=cert | |
else | |
name=$1 | |
fi | |
echo "Generating an SSL private key to sign your certificate..." | |
openssl genrsa -aes-256-cbc -out $name.key 2048 | |
echo "Generating a Certificate Signing Request..." | |
openssl req -new -key $name.key -out $name.csr | |
echo "Removing passphrase from key (for nginx)..." | |
cp $name.key $name.key.org | |
openssl rsa -in $name.key.org -out $name.key | |
rm $name.key.org | |
echo "Generating certificate..." | |
openssl x509 -req -days 365 -in $name.csr -signkey $name.key -out $name.crt | |
#echo "Copying certificate ($name) to /etc/nginx/ssl/" | |
#mkdir -p /etc/nginx/ssl | |
#cp $name.crt /etc/nginx/ssl/ | |
#echo "Copying key (myssl.key) to /etc/nginx/ssl/" | |
#mkdir -p /etc/nginx/ssl | |
#cp $name.key /etc/nginx/ssl/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment