Last Updated: February 25, 2016
·
2.069K
· gordjw

Script to generate SSL certificates

I often find myself needing to generate SSL certificates for websites in dev, so I made a small script to automate this, nothing fancy.

#! /bin/bash

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out private_nopass.key
openssl x509 -req -days 365 -in server.csr -signkey private_nopass.key -out site.crt

rm server.key.org
rm server.csr

chmod 0600 private_nopass.key
chmod 0600 site.crt

It will leave you with two files, a passphrase free key, and an SSL certificate. Just copy them to wherever your site config is looking.

1 Response
Add your response

over 1 year ago ·