Update 'installer.sh'
This commit is contained in:
49
installer.sh
49
installer.sh
@@ -60,14 +60,13 @@ domonly=${domain}
|
||||
domain=mail.${domain}
|
||||
branch=stable
|
||||
dhparam=1024
|
||||
term=TERM=ansi
|
||||
debconf-set-selections <<< "postfix postfix/mailname string $(hostname -f)"
|
||||
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
|
||||
|
||||
##----------------##
|
||||
# Pre-Config #
|
||||
##----------------##
|
||||
$ansi whiptail --title "Info" --infobox "Pre-Configuring" 8 20
|
||||
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
|
||||
@@ -91,7 +90,7 @@ chmod -R 755 /var/www
|
||||
##----------------------##
|
||||
# Pre-Requirements #
|
||||
##----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Buzzy like a bee" 8 20
|
||||
TERM=ansi whiptail --title "Info" --infobox "Buzzy like a bee" 8 20
|
||||
$PKGM update
|
||||
$PKGI software-properties-common
|
||||
$PKGA universe -y > $OUTPUT 2>&1
|
||||
@@ -115,7 +114,7 @@ $PKGM autoremove -y
|
||||
##-----------------------##
|
||||
# HTML Folder Perms #
|
||||
##-----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring HTML permissions" 8 32
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring HTML permissions" 8 32
|
||||
sleep 1
|
||||
chown -R www-data:www-data /var/www/"$domain"/html
|
||||
|
||||
@@ -123,7 +122,7 @@ chown -R www-data:www-data /var/www/"$domain"/html
|
||||
# NGINX #
|
||||
##-----------##
|
||||
#$PKGI nginx
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Nginx" 8 21
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Nginx" 8 21
|
||||
sleep 1
|
||||
wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Web/raw/branch/master/config/nginx/nginx-default.conf -O /etc/nginx/nginx.conf
|
||||
|
||||
@@ -241,7 +240,7 @@ ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
|
||||
##-------------------------------##
|
||||
# NGINX Single core bug fix #
|
||||
##-------------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Applying Nginx bug-fix" 8 26
|
||||
TERM=ansi whiptail --title "Info" --infobox "Applying Nginx bug-fix" 8 26
|
||||
sleep 1
|
||||
mkdir /etc/systemd/system/nginx.service.d
|
||||
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
|
||||
@@ -250,14 +249,14 @@ systemctl daemon-reload
|
||||
##-----------------------##
|
||||
# MySQL Installation #
|
||||
##-----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Installing MySQL" 8 20
|
||||
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
|
||||
|
||||
##------------------------------##
|
||||
# MySQL_Secure_Installation #
|
||||
##------------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Securing MySQL" 8 19
|
||||
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
|
||||
@@ -269,7 +268,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
|
||||
##-----------------------------##
|
||||
# MySQL Database Creation #
|
||||
##-----------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Creating MySQL Databases" 8 28
|
||||
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
|
||||
@@ -281,7 +280,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
|
||||
$ansi whiptail --title "Info" --infobox "Configuring PostfixAdmin" 8 28
|
||||
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-dark.tar.gz -O /tmp/postfixadmin.tar.gz
|
||||
tar -xf /tmp/postfixadmin.tar.gz -C /var/www/"$domain"/html/postfixadmin --strip-components=1
|
||||
@@ -297,7 +296,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail > $OUT
|
||||
##--------------------##
|
||||
# Certbot (Auto) #
|
||||
##--------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Certbot" 8 23
|
||||
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
|
||||
@@ -311,7 +310,7 @@ $ansi whiptail --title "Info" --infobox "Configuring Certbot" 8 23
|
||||
##----------------------##
|
||||
# Certbot (Manual) #
|
||||
##----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Certbot (manual)" 8 32
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Certbot (manual)" 8 32
|
||||
sleep 1
|
||||
mkdir -p /etc/letsencrypt/live/$domain/
|
||||
sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/nginx/sites-available/"$domain"
|
||||
@@ -342,7 +341,7 @@ debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Si
|
||||
##---------------------------##
|
||||
# Postfix Configuration #
|
||||
##---------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Postfix" 8 23
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Postfix" 8 23
|
||||
sleep 1
|
||||
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
|
||||
@@ -393,7 +392,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/$bran
|
||||
##---------------------------##
|
||||
# Dovecot Configuration #
|
||||
##---------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Dovecot" 8 23
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Dovecot" 8 23
|
||||
sleep 1
|
||||
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
|
||||
@@ -413,7 +412,7 @@ chmod +x /usr/local/bin/quota-warning.sh
|
||||
##--------------------------------------##
|
||||
# Dovecot move Spam to Spam Folder #
|
||||
##--------------------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Spam Folder" 8 27
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Spam Folder" 8 27
|
||||
sleep 1
|
||||
#$PKGI dovecot-sieve dovecot-managesieved
|
||||
mkdir -p /etc/dovecot/sieve/
|
||||
@@ -429,7 +428,7 @@ chgrp dovecot /etc/dovecot/sieve/default.svbin > $OUTPUT 2>&1
|
||||
# Spamassassin #
|
||||
##------------------##
|
||||
#$PKGI spamassassin spamc razor pyzor
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Spamassassin" 8 28
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Spamassassin" 8 28
|
||||
sleep 1
|
||||
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
|
||||
@@ -455,7 +454,7 @@ echo "endif # Mail::SpamAssassin::Plugin::Shortcircuit" >> /etc/spamassassin/loc
|
||||
# ClamAV #
|
||||
##------------##
|
||||
#$PKGI clamav clamav-daemon clamsmtp libclamunrar7 clamdscan
|
||||
$ansi whiptail --title "Info" --infobox "Configuring ClamAV" 8 22
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring ClamAV" 8 22
|
||||
sleep 1
|
||||
mkdir -p /var/log/clamav
|
||||
mkdir -p /var/lib/clamav
|
||||
@@ -468,7 +467,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
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Amavis" 8 22
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Amavis" 8 22
|
||||
sleep 1
|
||||
sed -i -e 's/@bypass/'@bypass'/' -e 's/ / /' /etc/amavis/conf.d/15-content_filter_mode
|
||||
adduser clamav amavis >/dev/null
|
||||
@@ -503,7 +502,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$bra
|
||||
# Rainloop #
|
||||
##--------------##
|
||||
#$PKGI unzip
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Rainloop" 8 24
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Rainloop" 8 24
|
||||
sleep 1
|
||||
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
|
||||
@@ -513,7 +512,7 @@ ln -s /opt/rainloop /var/www/"$domain"/html/
|
||||
# Fail2Ban #
|
||||
##--------------##
|
||||
#$PKGI fail2ban
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Fail2Ban" 8 24
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Fail2Ban" 8 24
|
||||
sleep 1
|
||||
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
|
||||
@@ -525,7 +524,7 @@ systemctl restart fail2ban > $OUTPUT 2>&1
|
||||
##---------------------------------##
|
||||
# Unattended Security Updates #
|
||||
##---------------------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Configuring Unattended Security Updates" 8 43
|
||||
TERM=ansi whiptail --title "Info" --infobox "Configuring Unattended Security Updates" 8 43
|
||||
sleep 1
|
||||
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
|
||||
@@ -533,21 +532,21 @@ source /tmp/unattended.sh
|
||||
##-----------------------##
|
||||
# Enabling Services #
|
||||
##-----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Enabling Services" 8 21
|
||||
TERM=ansi whiptail --title "Info" --infobox "Enabling Services" 8 21
|
||||
sleep 1
|
||||
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 #
|
||||
##-----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Restarting Services" 8 23
|
||||
TERM=ansi whiptail --title "Info" --infobox "Restarting Services" 8 23
|
||||
sleep 1
|
||||
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 #
|
||||
##------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Final Update" 8 16
|
||||
TERM=ansi whiptail --title "Info" --infobox "Final Update" 8 16
|
||||
sleep 1
|
||||
$PKGM update
|
||||
$PKGM upgrade -y
|
||||
@@ -556,7 +555,7 @@ $PKGM autoremove -y
|
||||
##----------------------##
|
||||
# End of installer #
|
||||
##----------------------##
|
||||
$ansi whiptail --title "Info" --infobox "Done installing!" 8 20
|
||||
TERM=ansi whiptail --title "Info" --infobox "Done installing!" 8 20
|
||||
sleep 3
|
||||
whiptail --title "Credits" --msgbox "Made by: your local Wizard and God" 8 38
|
||||
clear
|
||||
Reference in New Issue
Block a user