{
IFS=/ read SERVERNAME DAYS
openssl genrsa -out /tmp/ca.key 1024
openssl req -new -key /tmp/ca.key -out /tmp/ca.csr -subj /CN=$SERVERNAME/
openssl x509 -req -in /tmp/ca.csr -out /tmp/ca.cert -signkey /tmp/ca.key -days $DAYS
cat /tmp/ca.key /tmp/ca.cert > $SERVERNAME.pem
rm -f /tmp/ca.key /tmp/ca.csr /tmp/ca.cert
chmod 600 $SERVERNAME.pem
} <<< www.domain.com/365