cfg/bin/sslcert
2016-07-21 16:29:54 +02:00

22 lines
370 B
Bash
Executable file

#!/bin/bash
selfsigned=false
while getopts s opt; do
case $opt in
s)
selfsigned=true
;;
esac
done
shift $(( OPTIND - 1 ))
domain=$1
openssl genrsa -out ${domain}.key 2048
openssl req -new -sha256 -key ${domain}.key -out ${domain}.csr
if $selfsigned; then
openssl x509 -req -days 365 -in ${domain}.csr -signkey ${domain}.key -out ${domain}.crt
fi