cfg/bin/sslcert

23 lines
372 B
Text
Raw Normal View History

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