CodyKochmann
10/16/2015 - 11:50 PM

This is a shell script used to automate the generation of self signed certificates for a https hosted site.

This is a shell script used to automate the generation of self signed certificates for a https hosted site.

# this needs to be hardened a little more on line 9
echo "Enter the full site's name (mail.example.com)" \
&& read site_name \
&& mkdir -p /etc/nginx/ssl/$site_name \
&& cd /etc/nginx/ssl/$site_name \
&& suggestion=`openssl rand -base64 4096 | openssl dgst -sha512 | sed "s/(stdin)= //g"` \
&& echo "Here is a secure password you can use - ${suggestion}" \
&& suggestion="" \
&& openssl genrsa -des3 -out server.key 2048 \
&& openssl rsa -in server.key -out server.key \
&& openssl req -new -key server.key -out server.csr \
&& openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt