create new vars, remove placeholder domain
This commit is contained in:
parent
c68120d55e
commit
3ac3ee2b75
|
@ -29,19 +29,24 @@ vmail:getoptions "$@"
|
||||||
if [[ -z $domain ]]; then
|
if [[ -z $domain ]]; then
|
||||||
echo "ERROR: domain name is required"
|
echo "ERROR: domain name is required"
|
||||||
exit 1
|
exit 1
|
||||||
|
else
|
||||||
|
# set vars
|
||||||
|
maildomain="mail.$domain"
|
||||||
|
pemfile="$maildomain.pem"
|
||||||
|
confile="$maildomain.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that letsencrypt cert exists
|
# check that letsencrypt cert exists
|
||||||
if [ ! -f /etc/ssl/letsencrypt/mail.$domain.pem ]; then
|
if [ ! -f /etc/ssl/letsencrypt/$pemfile ]; then
|
||||||
echo "Let's Encrypt cert for mail.$domain does not exist, create that first:"
|
echo "Let's Encrypt cert for $maildomain does not exist, create that first:"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create dovecot config & restart
|
# create dovecot config & restart
|
||||||
if [ ! -f "/etc/dovecot/sites.d/mail.$domain.conf" ]; then
|
if [ ! -f "/etc/dovecot/sites.d/$confile" ]; then
|
||||||
echo "local_name mail.pawderosa.com {" > /etc/dovecot/sites.d/mail.$domain.conf
|
echo "local_name $maildomain {" > /etc/dovecot/sites.d/$confile
|
||||||
echo " ssl_cert = </etc/ssl/letsencrypt/mail.pawderosa.com.pem" >> /etc/dovecot/sites.d/mail.$domain.conf
|
echo " ssl_cert = </etc/ssl/letsencrypt/$pemfile" >> /etc/dovecot/sites.d/$confile
|
||||||
echo " ssl_key = </etc/ssl/letsencrypt/mail.pawderosa.com.pem" >> /etc/dovecot/sites.d/mail.$domain.conf
|
echo " ssl_key = </etc/ssl/letsencrypt/$pemfile" >> /etc/dovecot/sites.d/$confile
|
||||||
echo "}" >> /etc/dovecot/sites.d/mail.$domain.conf
|
echo "}" >> /etc/dovecot/sites.d/$confile
|
||||||
/usr/bin/systemctl --quiet is-active dovecot && systemctl --quiet reload dovecot
|
/usr/bin/systemctl --quiet is-active dovecot && systemctl --quiet reload dovecot
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user