From 211458008d181fc95454b3fd62a121f06341b34e Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Fri, 20 Sep 2019 01:44:28 +0200 Subject: [PATCH] Update 'installer.sh' Added "msg function" for configuring the spam into spam folder. Updated a few SED commands in the Postfix and Dovecot section. Added Amavis to the service disable and to crontab sections. Disabled Postfix and Dovecot service on start. They will start with Amavis after the delay is done. Added end-screen for Legacy mode to display the URL, Pasword and Logon. --- installer.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/installer.sh b/installer.sh index cb7e5b2..4eae8a0 100644 --- a/installer.sh +++ b/installer.sh @@ -46,7 +46,6 @@ fi ##---------------## # Functions # ##---------------## - msg () { if [ $IMODE = n ]; then TERM=ansi whiptail --title "Info" --infobox "$1" 8 52 @@ -132,10 +131,8 @@ chown -R www-data:www-data /var/www/"$domain"/html msg " Configuring Nginx" sleep 2 wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/config/nginx/nginx-default.conf -O /etc/nginx/nginx.conf - wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/stable/config/nginx/PostfixAdmin-site-unconfigured -O /etc/nginx/sites-available/"$domain" sed -i -e 's/DOMAINname/'$domain'/' -e 's/PHPver/'$phpver'/' /etc/nginx/sites-available/"$domain" - ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/ ##-------------------------------## @@ -243,12 +240,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$bra wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/postfix/mysql_virtual_alias_maps.cf -O /etc/postfix/sql/mysql_virtual_alias_maps.cf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/postfix/mysql_virtual_domains_maps.cf -O /etc/postfix/sql/mysql_virtual_domains_maps.cf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/postfix/mysql_virtual_mailbox_maps.cf -O /etc/postfix/sql/mysql_virtual_mailbox_maps.cf -sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_domains_maps.cf -sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_alias_maps.cf -sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_alias_domain_maps.cf -sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf -sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_mailbox_maps.cf -sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf +sed -i 's/PASSword/'$password'/g' /etc/postfix/sql/mysql_virtual_domains_maps.cf mysql_virtual_alias_maps.cf mysql_virtual_alias_domain_maps.cf mysql_virtual_alias_domain_catchall_maps.cf mysql_virtual_mailbox_maps.cf mysql_virtual_alias_domain_mailbox_maps.cf echo "#MySQL Database" >> /etc/postfix/main.cf postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf" postconf -e "virtual_alias_maps = mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf" @@ -289,15 +281,14 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$bra wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/dovecot-dict-sql.conf.ext -O /etc/dovecot/dovecot-dict-sql.conf.ext wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/dovecot-sql.conf.ext -O /etc/dovecot/dovecot-sql.conf.ext wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/quota-warning.sh -O /usr/local/bin/quota-warning.sh -sed -i 's/PASSword/'$password'/g' /etc/dovecot/dovecot-sql.conf.ext -sed -i 's/PASSword/'$password'/g' /etc/dovecot/dovecot-dict-sql.conf.ext +sed -i 's/PASSword/'$password'/g' /etc/dovecot/dovecot-sql.conf.ext dovecot-dict-sql.conf.ext sed -i -e 's/DOMAINname/'$domain'/' -e 's/#ssl_cert = /ssl_cert = /' -e 's/#ssl_key = /ssl_key = /' -e 's/#ssl_dh = /ssl_dh = /' /etc/dovecot/conf.d/10-ssl.conf chmod +x /usr/local/bin/quota-warning.sh ##--------------------------------------## # Dovecot move Spam to Spam Folder # ##--------------------------------------## -TERM=ansi whiptail --title "Info" --infobox " Configuring Spam Folder" 8 52 +msg " Configuring Spam Folder" sleep 2 mkdir -p /etc/dovecot/sieve/ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/$branch/config/dovecot/15-lda.conf -O /etc/dovecot/conf.d/15-lda.conf @@ -413,8 +404,8 @@ source /tmp/unattended.sh msg " Setting up system services" sleep 2 systemctl enable nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin > $OUTPUT 2>&1 -systemctl disable amavisd-snmp-subagent amavis-mc > $OUTPUT 2>&1 -systemctl stop amavisd-snmp-subagent amavis-mc postfix dovecot > $OUTPUT 2>&1 +systemctl disable amavis amavisd-snmp-subagent amavis-mc postfix dovecot> $OUTPUT 2>&1 +systemctl stop amavis amavisd-snmp-subagent amavis-mc postfix dovecot > $OUTPUT 2>&1 systemctl restart nginx mysql postfix@- fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin > $OUTPUT 2>&1 ##---------------------------------## @@ -430,7 +421,7 @@ systemctl restart nginx mysql postfix@- fail2ban clamav-daemon clamav-freshclam # Configuring Services # ##-------------------------## systemctl start amavisd-snmp-subagent amavis-mc postfix dovecot > $OUTPUT 2>&1 -echo "@reboot root systemctl stop amavisd-snmp-subagent amavis-mc postfix dovecot && sleep 300 && systemctl start amavisd-snmp-subagent amavis-mc postfix dovecot" >> /etc/crontab +echo "@reboot root sleep 300 && systemctl start amavis amavisd-snmp-subagent amavis-mc postfix dovecot" >> /etc/crontab ##------------------## # Final Update # @@ -452,3 +443,14 @@ whiptail --title "Info" --msgbox "Point your browser to https://$domain/postfixa whiptail --title "Credits" --msgbox " Made by: your local Wizard and God" 8 78 clear fi + +elif [ $IMODE = l ]; then +clear +echo "Point your browser to https://$domain/postfixadmin to get started" +echo "" +echo "Your login is: superadmin@$domonly" +echo "Your password is: $password" +echo "" +read -p "Press enter to continue" +clear +fi \ No newline at end of file