diff --git a/installer.sh b/installer.sh index af5f470..502fca0 100644 --- a/installer.sh +++ b/installer.sh @@ -256,7 +256,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" >/dev/null ##------------------## $PKGI php${phpver} php${phpver}-zip php${phpver}-fpm php${phpver}-cli php${phpver}-json php${phpver}-mysql php${phpver}-opcache php${phpver}-mbstring php${phpver}-readline $PKGI libc-client2007e mlock php${phpver}-common php${phpver}-imap -whiptail --title "Configuring PostfixADMIN" --infobox "Busy like a bee" 8 45 +whiptail --title "Configuring PostfixAdmin" --infobox "Busy like a bee" 8 45 mkdir -p /var/www/"$domain"/html/postfixadmin/templates_c wget -q -t7 https://git.ictmaatwerk.com/downloads/pfa/postfixadmin-3.1.tar.gz -O /tmp/postfixadmin.tar.gz tar -xf /tmp/postfixadmin.tar.gz -C /var/www/"$domain"/html/postfixadmin --strip-components=1 >/dev/null @@ -272,6 +272,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail >/dev/ ##--------------------## # Certbot (Auto) # ##--------------------## +#whiptail --title "Configuring Certbot" --infobox "Busy like a bee" 8 45 #add-apt-repository ppa:certbot/certbot -y #apt install -y python-certbot-nginx #certbot --nginx -n -d "$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos @@ -285,6 +286,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail >/dev/ ##----------------------## # Certbot (Manual) # ##----------------------## +whiptail --title "Configuring Certbot (manual)" --infobox "Busy like a bee" 8 45 mkdir -p /etc/letsencrypt/live/$domain/ sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/nginx/sites-available/"$domain" sed -i 's/listen 443 ssl/listen 443 ssl http2/g' /etc/nginx/sites-available/"$domain" @@ -294,8 +296,8 @@ 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/lets-encrypt/fullchain.pem -O /etc/letsencrypt/live/$domain/fullchain.pem wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/lets-encrypt/privkey.pem -O /etc/letsencrypt/live/$domain/privkey.pem wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/nginx/site-enabled -O /etc/nginx/sites-available/mail.ictdownwerk.com -openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam" -openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem "$dhparam" +openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam" >/dev/null +openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem "$dhparam" >/dev/null chmod 777 -R /etc/letsencrypt/ssl-dhparams.pem chmod 777 -R /etc/ssl/certs/dhparam.pem chmod 777 -R /etc/letsencrypt/live/$domain/cert.pem @@ -309,11 +311,12 @@ chmod 644 -R /etc/nginx/sites-available/mail.ictdownwerk.com ##-----------------------## debconf-set-selections <<< "postfix postfix/mailname string $(hostname -f)" debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" -apt install postfix postfix-mysql -y +$PKGI postfix postfix-mysql ##---------------------------## # Postfix Configuration # ##---------------------------## +whiptail --title "Configuring Postfix" --infobox "Busy like a bee" 8 45 mkdir -p /etc/postfix/sql wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/postfix/mysql_virtual_alias_domain_catchall_maps.cf -O /etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/postfix/mysql_virtual_alias_domain_mailbox_maps.cf -O /etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf @@ -357,12 +360,13 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/$bran ##-----------------------## 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 update -apt install dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql -y +$PKGM update +$PKGI dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql ##---------------------------## # Dovecot Configuration # ##---------------------------## +whiptail --title "Configuring Dovecot" --infobox "Busy like a bee" 8 45 wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/15-mailboxes.conf -O /etc/dovecot/conf.d/15-mailboxes.conf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/10-mail.conf -O /etc/dovecot/conf.d/10-mail.conf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/10-auth.conf -O /etc/dovecot/conf.d/10-auth.conf @@ -381,20 +385,20 @@ chmod +x /usr/local/bin/quota-warning.sh ##--------------------------------------## # Dovecot move Spam to Spam Folder # ##--------------------------------------## -apt install dovecot-sieve dovecot-managesieved -y +$PKGI dovecot-sieve dovecot-managesieved 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 wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/dovecot/90-sieve.conf -O /etc/dovecot/conf.d/90-sieve.conf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/sieve/default.sieve -O /etc/dovecot/sieve/default.sieve chown vmail:vmail /etc/dovecot/sieve/ -R chgrp dovecot /etc/dovecot/conf.d/90-sieve.conf -sievec /etc/dovecot/sieve/default.sieve -chgrp dovecot /etc/dovecot/sieve/default.svbin +sievec /etc/dovecot/sieve/default.sieve >/dev/null +chgrp dovecot /etc/dovecot/sieve/default.svbin >/dev/null ##------------------## # Spamassassin # ##------------------## -apt install spamassassin spamc razor pyzor -y +$PKGI spamassassin spamc razor pyzor sed -i -e 's/# report_safe 1/report_safe 0/' -e 's/# required_score 5.0/required_score 5.0/' -e 's/endif # Mail::SpamAssassin::Plugin::Shortcircuit//' /etc/spamassassin/local.cf echo "" >> /etc/spamassassin/local.cf echo "skip_rbl_checks 0" >> /etc/spamassassin/local.cf @@ -418,7 +422,7 @@ echo "endif # Mail::SpamAssassin::Plugin::Shortcircuit" >> /etc/spamassassin/loc ##------------## # ClamAV # ##------------## -apt install clamav clamav-daemon clamsmtp libclamunrar7 clamdscan -y +$PKGI clamav clamav-daemon clamsmtp libclamunrar7 clamdscan mkdir -p /var/log/clamav mkdir -p /var/lib/clamav chown -R clamav:clamav /var/log/clamav @@ -428,10 +432,10 @@ chmod 775 -R /var/lib/clamav/* /var/lib/clamav ##------------## # Amavis # ##------------## -apt install amavisd-new -y -apt install zip lrzip liblz4-tool lhasa arj unzip bzip2 nomarch cpio lzop cabextract arc apt-listchanges libauthen-sasl-perl libdbd-mysql-perl libdbi-perl libmail-dkim-perl ripole p7zip p7zip-full p7zip-rar rpm unrar unrar-free altermime libsnmp-perl libnet-ldap-perl libnet-ph-perl libnet-snpp-perl libnet-telnet-perl -y +$PKGI amavisd-new +$PKGI zip lrzip liblz4-tool lhasa arj unzip bzip2 nomarch cpio lzop cabextract arc apt-listchanges libauthen-sasl-perl libdbd-mysql-perl libdbi-perl libmail-dkim-perl ripole p7zip p7zip-full p7zip-rar rpm unrar unrar-free altermime libsnmp-perl libnet-ldap-perl libnet-ph-perl libnet-snpp-perl libnet-telnet-perl sed -i -e 's/@bypass/'@bypass'/' -e 's/ / /' /etc/amavis/conf.d/15-content_filter_mode -adduser clamav amavis +adduser clamav amavis >/dev/null sed -i 's/clamd.conf/'clamd.conf'/g' /etc/clamav/freshclam.conf echo "#Pipe incoming mail trough Amavis" >> /etc/postfix/main.cf postconf -e 'content_filter = amavis:[127.0.0.1]:10024' @@ -462,37 +466,37 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$bra ##--------------## # Rainloop # ##--------------## -apt install unzip -y +$PKGI unzip wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/rainloop.sh -O /tmp/rainloop.sh -source /tmp/rainloop.sh +source /tmp/rainloop.sh >/dev/null ln -s /opt/rainloop /var/www/"$domain"/html/ ##--------------## # Fail2Ban # ##--------------## -apt install fail2ban -y +$PKGI fail2ban wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/fail2ban/dovecot-pop3imap.conf -O /etc/fail2ban/filter.d/dovecot-pop3imap.conf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/fail2ban/postfix-sasl.conf -O /etc/fail2ban/filter.d/postfix-sasl.conf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/fail2ban/rainloop.conf -O /etc/fail2ban/filter.d/rainloop.conf wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/fail2ban/jail.local -O /etc/fail2ban/jail.local sed -i 's/root@localhost/'$email'/g' /etc/fail2ban/jail.conf -systemctl restart fail2ban +systemctl restart fail2ban >/dev/null ##---------------------------------## # Unattended Security Updates # ##---------------------------------## wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Unattended-Security-Updates/raw/branch/master/installer.sh -O /tmp/unattended.sh -source /tmp/unattended.sh +source /tmp/unattended.sh >/dev/null ##-----------------------## # Enabling Services # ##-----------------------## -systemctl enable nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent +systemctl enable nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent >/dev/null ##-----------------------## # Starting Services # ##-----------------------## -systemctl restart nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent +systemctl restart nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent >/dev/null ##------------------## # Final Update #