Home > Linux > Self Signed Certificate Script

Self Signed Certificate Script

November 18th, 2016 Leave a comment Go to comments

Just a small script to generate self signed certificates.

#!/bin/bash
if [[ $EUID -ne 0  ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
fi
if [ "$#" -ne 1 ]; then
        echo "No site name supplied e.g. jenkins"
        exit
fi
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
Categories: Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.

Time limit is exhausted. Please reload CAPTCHA.