Update 'installer.sh'

This commit is contained in:
b.waal
2019-09-17 14:36:24 +02:00
parent 55a5aff948
commit 7f03857243

View File

@@ -64,7 +64,7 @@ debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Si
##----------------##
# Pre-Config #
##----------------##
TERM=ansi whiptail --title "Pre-Configuring" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Pre-Configuring" 8 20
sleep 2
hostnamectl set-hostname $domain > $OUTPUT 2>&1
timedatectl set-timezone Europe/Amsterdam > $OUTPUT 2>&1
@@ -88,7 +88,7 @@ chmod -R 755 /var/www
##----------------------##
# Pre-Requirements #
##----------------------##
TERM=ansi whiptail --title "" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "" --infobox "" 0 0
$PKGM update
$PKGI software-properties-common
$PKGA universe -y > $OUTPUT 2>&1
@@ -101,7 +101,7 @@ $PKGM upgrade -y
##-----------------------------##
# Installing Requirements #
##-----------------------------##
$PKGI nginx postfix postfix-mysql php${phpver} php${phpver}-curl php${phpver}-dom php${phpver}-common php${phpver}-imap php${phpver}-zip php${phpver}-fpm php${phpver}-cli php${phpver}-json php${phpver}-mysql php${phpver}-opcache php${phpver}-mbstring php${phpver}-readline libc-client2007e mlock gnupg2 curl dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-managesieved spamassassin spamc razor pyzor clamav clamav-daemon clamsmtp libclamunrar7 clamdscan amavisd-new 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 unzip fail2ban
$PKGI nginx postfix postfix-mysql php${phpver} php${phpver}-curl php${phpver}-dom php${phpver}-common php${phpver}-imap php${phpver}-zip php${phpver}-fpm php${phpver}-cli php${phpver}-json php${phpver}-mysql php${phpver}-opcache php${phpver}-mbstring php${phpver}-readline libc-client2007e mlock gnupg2 curl dovecot-imapd dovecot-lmtpd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-managesieved spamassassin spamc razor pyzor clamav clamav-daemon clamsmtp libclamunrar7 clamdscan amavisd-new 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 unzip unattended-upgrades fail2ban
##-------------##
# Debloat #
@@ -242,7 +242,7 @@ systemctl restart nginx
##-----------------------##
# MySQL Installation #
##-----------------------##
TERM=ansi whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Installing MySQL" 8 20
wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-MySQL/raw/branch/master/mysql-8.0.sh -O /tmp/mysql-8.0.sh
source /tmp/mysql-8.0.sh
@@ -250,7 +250,7 @@ source /tmp/mysql-8.0.sh
##------------------------------##
# MySQL_Secure_Installation #
##------------------------------##
TERM=ansi whiptail --title "Securing MySQL" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Securing MySQL" 8 19
mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User=''" > $OUTPUT 2>&1
@@ -262,7 +262,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
##-----------------------------##
# MySQL Database Creation #
##-----------------------------##
TERM=ansi whiptail --title "Creating MySQL Databases" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Creating MySQL Databases" 8 28
mysql -u root -p"$password" -e "CREATE DATABASE postfixadmin;" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "CREATE USER '"postfixadmin"'@'localhost' IDENTIFIED BY '"$password"';" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "GRANT ALL ON "postfixadmin".* TO "postfixadmin"@'localhost';" > $OUTPUT 2>&1
@@ -274,7 +274,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
$PKGI postfix postfix-mysql
#$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
TERM=ansi whiptail --title "Configuring PostfixAdmin" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring PostfixAdmin" 8 28
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
@@ -290,7 +290,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail > $OUT
##--------------------##
# Certbot (Auto) #
##--------------------##
#whiptail --title "Configuring Certbot" --infobox "Busy like a bee" 8 45
#TERM=ansi whiptail --title "Info" --infobox "Configuring Certbot" 8 23
#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
@@ -304,7 +304,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail > $OUT
##----------------------##
# Certbot (Manual) #
##----------------------##
TERM=ansi whiptail --title "Configuring Certbot (manual)" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Certbot (manual)" 8 32
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"
@@ -334,7 +334,7 @@ debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Si
##---------------------------##
# Postfix Configuration #
##---------------------------##
TERM=ansi whiptail --title "Configuring Postfix" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Postfix" 8 23
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
@@ -384,7 +384,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/$bran
##---------------------------##
# Dovecot Configuration #
##---------------------------##
TERM=ansi whiptail --title "Configuring Dovecot" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Dovecot" 8 23
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
@@ -403,6 +403,8 @@ chmod +x /usr/local/bin/quota-warning.sh
##--------------------------------------##
# Dovecot move Spam to Spam Folder #
##--------------------------------------##
TERM=ansi whiptail --title "Info" --infobox "Configuring Spam Folder" 8 27
sleep 2
#$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
@@ -417,7 +419,7 @@ chgrp dovecot /etc/dovecot/sieve/default.svbin > $OUTPUT 2>&1
# Spamassassin #
##------------------##
#$PKGI spamassassin spamc razor pyzor
TERM=ansi whiptail --title "Configuring Spamassassin" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Spamassassin" 8 28
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
@@ -442,7 +444,7 @@ echo "endif # Mail::SpamAssassin::Plugin::Shortcircuit" >> /etc/spamassassin/loc
# ClamAV #
##------------##
#$PKGI clamav clamav-daemon clamsmtp libclamunrar7 clamdscan
whiptail --title "Configuring ClamAV" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring ClamAV" 8 22
sleep 2
mkdir -p /var/log/clamav
mkdir -p /var/lib/clamav
@@ -455,7 +457,7 @@ chmod 775 -R /var/lib/clamav/* /var/lib/clamav
##------------##
#$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
TERM=ansi whiptail --title "Configuring Amavis" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Amavis" 8 22
sed -i -e 's/@bypass/'@bypass'/' -e 's/ / /' /etc/amavis/conf.d/15-content_filter_mode
adduser clamav amavis >/dev/null
sed -i 's/clamd.conf/'clamd.conf'/g' /etc/clamav/freshclam.conf
@@ -489,7 +491,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$bra
# Rainloop #
##--------------##
#$PKGI unzip
TERM=ansi whiptail --title "Configuring Rainloop" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Rainloop" 8 24
sleep 2
wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/rainloop.sh -O /tmp/rainloop.sh
source /tmp/rainloop.sh > $OUTPUT 2>&1
@@ -499,7 +501,7 @@ ln -s /opt/rainloop /var/www/"$domain"/html/
# Fail2Ban #
##--------------##
#$PKGI fail2ban
TERM=ansi whiptail --title "Configuring Fail2Ban" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Configuring Fail2Ban" 8 24
sleep 2
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
@@ -511,27 +513,29 @@ systemctl restart fail2ban > $OUTPUT 2>&1
##---------------------------------##
# Unattended Security Updates #
##---------------------------------##
TERM=ansi whiptail --title "Info" --infobox "Configuring Unattended Security Updates" 8 43
sleep 2
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
##-----------------------##
# Enabling Services #
##-----------------------##
TERM=ansi whiptail --title "Enabling Services" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Enabling Services" 8 21
sleep 2
systemctl enable nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent > $OUTPUT 2>&1
##-----------------------##
# Starting Services #
##-----------------------##
TERM=ansi whiptail --title "Restarting Services" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Restarting Services" 8 23
sleep 2
systemctl restart nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent > $OUTPUT 2>&1
##------------------##
# Final Update #
##------------------##
TERM=ansi whiptail --title "Finalizing Update" --infobox "Busy like a bee" 8 45
TERM=ansi whiptail --title "Info" --infobox "Final Update" 8 16
sleep 2
$PKGM update
$PKGM upgrade -y
@@ -540,7 +544,7 @@ $PKGM autoremove -y
##----------------------##
# End of installer #
##----------------------##
TERM=ansi whiptail --title "Done installing!" --infobox "" 8 45
TERM=ansi whiptail --title "Info" --infobox "Done installing!" 8 20
sleep 3
whiptail --title "Credits" --msgbox "Made by: your local Wizard and God" 8 78
whiptail --title "Credits" --msgbox "Made by: your local Wizard and God" 8 38
clear