Tag openssl

Automated creation of self signed SSL certificate

For developing websites with SSL on your local computer there is the need to create a self signed SSL certificate. As I often need this, I wrote this little script.

You may adjust the -subj part in line 4:

#!/bin/bash
password="password"
sudo openssl genrsa -passout pass:$password -des3 -out $1.key 1024
sudo openssl req -new -passin pass:$password -subj "/C=DE/ST=Saxony/L=Dresden/CN=$1" -key $1.key -out $1.csr
sudo openssl rsa -passin pass:$password -in $1.key -out $1.key
sudo openssl x509 -req -days 365 -in $1.csr -signkey $1.key -out $1.crt

Usage:

./create_self_signed_ssl.sh mydomain.local