23 lines
370 B
Text
23 lines
370 B
Text
|
#!/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
|