22 lines
372 B
Bash
Executable file
22 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
|