Update mailscannerinstaller.sh

Updated for Ubuntu 20.04
This commit is contained in:
hennaboy
2020-05-23 15:24:56 +01:00
parent 5d2255ecf2
commit b5aa5b4def

View File

@@ -27,6 +27,7 @@ fi
if [ -f /etc/os-release ];then if [ -f /etc/os-release ];then
OS=$(head -1 /etc/os-release) OS=$(head -1 /etc/os-release)
VERSION=$(sed '6q;d' /etc/os-release)
fi fi
if [ "$OS" = "NAME=\"CentOS Linux\"" ];then if [ "$OS" = "NAME=\"CentOS Linux\"" ];then
@@ -198,19 +199,23 @@ IPADDRESS=$(cat /etc/cyberpanel/machineIP)
echo 'Setting up spamassassin and sieve to deliver spam to Junk folder by default' echo 'Setting up spamassassin and sieve to deliver spam to Junk folder by default'
#echo "If you wish mailscanner/spamassassin to send spam email to a spam folder please follow the tutorial on the Cyberpanel Website" #echo "If you wish mailscanner/spamassassin to send spam email to a spam folder please follow the tutorial on the Cyberpanel Website"
echo 'Fix protocols' echo 'Fix protocols'
sed -i 's/^protocols =.*/protocols = imap pop3 sieve/g' /etc/dovecot/dovecot.conf sed -i 's/^protocols =.*/protocols = imap pop3 lmtp sieve/g' /etc/dovecot/dovecot.conf
sed -i "s|^user_query.*|user_query = SELECT '5000' as uid, '5000' as gid, '/home/vmail/%d/%n' as home,mail FROM e_users WHERE email='%u';|g" /etc/dovecot/dovecot-sql.conf.ext sed -i "s|^user_query.*|user_query = SELECT '5000' as uid, '5000' as gid, '/home/vmail/%d/%n' as home,mail FROM e_users WHERE email='%u';|g" /etc/dovecot/dovecot-sql.conf.ext
if [ "$OS" = "NAME=\"Ubuntu\"" ];then if [ "$OS" = "NAME=\"Ubuntu\"" ];then
if [ "$VERSION" = "VERSION_ID=\"18.04\"" ];then
apt-get install -y dovecot-managesieved dovecot-sieve net-tools pflogsumm apt-get install -y dovecot-managesieved dovecot-sieve dovecot-lmtpd net-tools pflogsumm
elif [ "$VERSION" = "VERSION_ID=\"20.04\"" ];then
apt-get install -y libmysqlclient-dev
sed -e '/deb/ s/^#*/#/' -i /etc/apt/sources.list.d/dovecot.list
apt install -y dovecot-lmtpd dovecot-managesieved dovecot-sieve net-tools pflogsumm
fi
elif [ "$OS" = "NAME=\"CentOS Linux\"" ];then elif [ "$OS" = "NAME=\"CentOS Linux\"" ];then
yum install -y nano net-tools dovecot-pigeonhole postfix-perl-scripts yum install -y nano net-tools dovecot-pigeonhole postfix-perl-scripts
fi fi
@@ -276,6 +281,7 @@ postmaster_address=$(grep postmaster_address /etc/dovecot/dovecot.conf | sed 's
sed -i "s|postmaster@example.com|$postmaster_address|g" /etc/dovecot/dovecot.conf sed -i "s|postmaster@example.com|$postmaster_address|g" /etc/dovecot/dovecot.conf
sed -i "s|server.example.com|$hostname|g" /etc/dovecot/dovecot.conf sed -i "s|server.example.com|$hostname|g" /etc/dovecot/dovecot.conf
sed -i "s|postmaster@example.com|$postmaster_address|g" /etc/dovecot/dovecot.conf
#Sieve the global spam filter #Sieve the global spam filter
sievec /etc/dovecot/sieve/default.sieve sievec /etc/dovecot/sieve/default.sieve