diff --git a/installer.sh b/installer.sh index bc6022d..f32775a 100644 --- a/installer.sh +++ b/installer.sh @@ -248,10 +248,13 @@ wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$ wget --tries=3 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 --tries=3 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 --tries=3 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 +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" postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf" +echo "#Use Dovecot's LMTP service as the default mail delivery" >> /etc/postfix/main.cf postconf -e "virtual_transport = lmtp:unix:private/dovecot-lmtp" +echo "#TLS and SSL certificate" >> /etc/postfix/main.cf postconf -e "smtp_tls_security_level = may" postconf -e "smtpd_tls_security_level = may" postconf -e "smtp_tls_note_starttls_offer = yes" @@ -259,6 +262,7 @@ postconf -e "smtpd_tls_loglevel = 1" postconf -e "smtpd_tls_received_header = yes" postconf -e "smtpd_tls_cert_file = /etc/letsencrypt/live/"$domain"/fullchain.pem" postconf -e "smtpd_tls_key_file = /etc/letsencrypt/live/"$domain"/privkey.pem" +echo "#SMTP Settings, hand off authentication to Dovecot" >> /etc/postfix/main.cf postconf -e "smtpd_sasl_type = dovecot" postconf -e "smtpd_sasl_path = private/auth" postconf -e "smtpd_sasl_local_domain =" @@ -267,4 +271,29 @@ postconf -e "broken_sasl_auth_clients = yes" postconf -e "smtpd_sasl_auth_enable = yes" postconf -e "smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination" sed -i 's/mynetworks = /#mynetworks = /g' /etc/postfix/main.cf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/$branch/config/postfix/master.cf -O /etc/postfix/master.cf systemctl restart postfix.service + +##-----------------------## +# Dovecot Installer # +##-----------------------## +wget -O- https://repo.dovecot.org/DOVECOT-REPO-GPG | sudo apt-key add - +echo "deb https://repo.dovecot.org/ce-2.3-latest/ubuntu/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/dovecot.list +apt install dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql + +##---------------------------## +# Dovecot Configuration # +##---------------------------## +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/15-mailboxes.conf -O /etc/dovecot/conf.d/15-mailboxes.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/90-sieve.conf -O /etc/dovecot/conf.d/90-sieve.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/10-mail.conf -O /etc/dovecot/conf.d/10-mail.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/10-auth.conf -O /etc/dovecot/conf.d/10-auth.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/10-master.conf -O /etc/dovecot/conf.d/10-master.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/10-ssl.conf -O /etc/dovecot/conf.d/10-ssl.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/20-lmtp.conf -O /etc/dovecot/conf.d/20-lmtp.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/src/branch/dev/config/dovecot/20-imap.conf -O /etc/dovecot/conf.d/20-imap.conf +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/dev/config/dovecot/dovecot-dict-sql.conf.ext -O /etc/dovecot/dovecot-dict-sql.conf.ext +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/dev/config/dovecot/dovecot-sql.conf.ext -O /etc/dovecot/dovecot-sql.conf.ext +wget --tries=3 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/dev/config/dovecot/quota-warning.sh -O /usr/local/bin/quota-warning.sh +chmod +x /usr/local/bin/quota-warning.sh +systemctl dovecot restart \ No newline at end of file