cfg/bin/sslcert
Knut Ahlers efc8bc4f3c
Throw shfmt against bash scripts
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-03-10 12:47:55 +01:00

23 lines
372 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