converted Whiptail to msg function
This commit is contained in:
62
installer.sh
62
installer.sh
@@ -43,6 +43,19 @@ echo "Administrator E-mail:"
|
||||
read email
|
||||
fi
|
||||
|
||||
##---------------##
|
||||
# Functions #
|
||||
##---------------##
|
||||
|
||||
msg () {
|
||||
if [ $IMODE = n ]; then
|
||||
TERM=ansi whiptail --title "Info" --infobox "$1" 8 52
|
||||
fi
|
||||
if [ $IMODE = l ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
##-----------------##
|
||||
# Static-Vars #
|
||||
##-----------------##
|
||||
@@ -59,7 +72,7 @@ debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Si
|
||||
##----------------##
|
||||
# Pre-Config #
|
||||
##----------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Pre-Configuring" 8 52
|
||||
msg " Pre-Configuring"
|
||||
sleep 2
|
||||
hostnamectl set-hostname $domain > $OUTPUT 2>&1
|
||||
timedatectl set-timezone Europe/Amsterdam > $OUTPUT 2>&1
|
||||
@@ -83,7 +96,7 @@ chmod -R 755 /var/www
|
||||
##----------------------##
|
||||
# Pre-Requirements #
|
||||
##----------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Buzzy like a bee" 8 52
|
||||
msg " Buzzy like a bee"
|
||||
$PKGM update
|
||||
$PKGI software-properties-common sudo
|
||||
$PKGA universe -y > $OUTPUT 2>&1
|
||||
@@ -108,7 +121,7 @@ $PKGM autoremove -y
|
||||
##-----------------------##
|
||||
# HTML Folder Perms #
|
||||
##-----------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring HTML permissions" 8 52
|
||||
msg " Configuring HTML permissions"
|
||||
sleep 2
|
||||
chown -R www-data:www-data /var/www/"$domain"/html
|
||||
|
||||
@@ -116,7 +129,7 @@ chown -R www-data:www-data /var/www/"$domain"/html
|
||||
# NGINX #
|
||||
##-----------##
|
||||
#$PKGI nginx
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Nginx" 8 52
|
||||
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
|
||||
|
||||
@@ -234,7 +247,7 @@ ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
|
||||
##-------------------------------##
|
||||
# NGINX Single core bug fix #
|
||||
##-------------------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Applying Nginx bug-fix" 8 52
|
||||
msg " Applying Nginx bug-fix"
|
||||
sleep 2
|
||||
mkdir /etc/systemd/system/nginx.service.d
|
||||
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
|
||||
@@ -243,14 +256,14 @@ systemctl daemon-reload
|
||||
##-----------------------##
|
||||
# MySQL Installation #
|
||||
##-----------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Installing MySQL" 8 52
|
||||
msg " Installing MySQL"
|
||||
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 #
|
||||
##------------------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Securing MySQL" 8 52
|
||||
msg " Securing MySQL"
|
||||
sleep 2
|
||||
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 +275,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
|
||||
##-----------------------------##
|
||||
# MySQL Database Creation #
|
||||
##-----------------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Creating MySQL Databases" 8 52
|
||||
msg " Creating MySQL Databases"
|
||||
sleep 2
|
||||
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
|
||||
@@ -272,7 +285,7 @@ mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1
|
||||
##------------------##
|
||||
# PostfixADMIN #
|
||||
##------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring PostfixAdmin" 8 52
|
||||
msg " Configuring PostfixAdmin"
|
||||
sleep 2
|
||||
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
|
||||
@@ -290,7 +303,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail > $OUT
|
||||
##--------------------##
|
||||
# Certbot (Auto) #
|
||||
##--------------------##
|
||||
#TERM=ansi whiptail --title "Info" --infobox " Configuring Certbot" 8 52
|
||||
msg " Configuring Certbot"
|
||||
#sleep 2
|
||||
#certbot --nginx -n -d "$domain" -m "$email" --hsts --redirect --no-eff-email --agree-tos
|
||||
#echo "certbot --nginx -n -d $domain -m $email --hsts --redirect --no-eff-email --agree-tos" > ~/certbotactivate.sh
|
||||
@@ -303,7 +316,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail > $OUT
|
||||
##----------------------##
|
||||
# Certbot (Manual) #
|
||||
##----------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Certbot (manual)" 8 52
|
||||
msg " Configuring Certbot (manual)"
|
||||
sleep 2
|
||||
mkdir -p /etc/letsencrypt/live/$domain/
|
||||
sed -i 's/ssl ipv6only/ssl http2 ipv6only/g' /etc/nginx/sites-available/"$domain"
|
||||
@@ -327,7 +340,7 @@ chmod 644 -R /etc/nginx/sites-available/mail.ictdownwerk.com
|
||||
##---------------------------##
|
||||
# Postfix Configuration #
|
||||
##---------------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Postfix" 8 52
|
||||
msg " Configuring Postfix"
|
||||
sleep 2
|
||||
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
|
||||
@@ -370,7 +383,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/$bran
|
||||
##---------------------------##
|
||||
# Dovecot Configuration #
|
||||
##---------------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Dovecot" 8 52
|
||||
msg " Configuring Dovecot"
|
||||
sleep 2
|
||||
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
|
||||
@@ -404,7 +417,7 @@ chgrp dovecot /etc/dovecot/sieve/default.svbin > $OUTPUT 2>&1
|
||||
##------------------##
|
||||
# Spamassassin #
|
||||
##------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Spamassassin" 8 52
|
||||
msg " Configuring Spamassassin"
|
||||
sleep 2
|
||||
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
|
||||
@@ -429,7 +442,7 @@ echo "endif # Mail::SpamAssassin::Plugin::Shortcircuit" >> /etc/spamassassin/loc
|
||||
##------------##
|
||||
# ClamAV #
|
||||
##------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring ClamAV" 8 52
|
||||
msg " Configuring ClamAV"
|
||||
sleep 2
|
||||
mkdir -p /var/log/clamav
|
||||
mkdir -p /var/lib/clamav
|
||||
@@ -440,7 +453,7 @@ chmod 775 -R /var/lib/clamav/* /var/lib/clamav
|
||||
##------------##
|
||||
# Amavis #
|
||||
##------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Amavis" 8 52
|
||||
msg " Configuring Amavis"
|
||||
sleep 2
|
||||
sed -i -e 's/@bypass/'@bypass'/' -e 's/ / /' /etc/amavis/conf.d/15-content_filter_mode
|
||||
adduser clamav amavis > $OUTPUT 2>&1
|
||||
@@ -474,7 +487,7 @@ wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$bra
|
||||
##--------------##
|
||||
# Rainloop #
|
||||
##--------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Rainloop" 8 52
|
||||
msg " Configuring Rainloop"
|
||||
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
|
||||
@@ -483,7 +496,7 @@ ln -s /opt/rainloop /var/www/"$domain"/html/
|
||||
##--------------##
|
||||
# Fail2Ban #
|
||||
##--------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Fail2Ban" 8 52
|
||||
msg " Configuring Fail2Ban"
|
||||
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
|
||||
@@ -495,7 +508,7 @@ systemctl restart fail2ban > $OUTPUT 2>&1
|
||||
##---------------------------------##
|
||||
# Unattended Security Updates #
|
||||
##---------------------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Configuring Unattended Security Updates" 8 52
|
||||
msg " Configuring Unattended Security Updates"
|
||||
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
|
||||
@@ -503,7 +516,7 @@ source /tmp/unattended.sh
|
||||
##---------------------##
|
||||
# System services #
|
||||
##---------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Setting up system services" 8 52
|
||||
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
|
||||
@@ -528,7 +541,7 @@ echo "@reboot root systemctl stop amavisd-snmp-subagent amavis-mc postfix doveco
|
||||
##------------------##
|
||||
# Final Update #
|
||||
##------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Final Update" 8 52
|
||||
msg " Final Update"
|
||||
sleep 2
|
||||
$PKGM update
|
||||
$PKGM upgrade -y
|
||||
@@ -537,8 +550,11 @@ $PKGM autoremove -y
|
||||
##----------------------##
|
||||
# End of installer #
|
||||
##----------------------##
|
||||
TERM=ansi whiptail --title "Info" --infobox " Done installing!" 8 52
|
||||
msg " Done installing!"
|
||||
sleep 3
|
||||
|
||||
if [ $IMODE = n ]; then
|
||||
whiptail --title "Info" --msgbox "Point your browser to https://$domain/postfixadmin to get started \n\nYour login is: superadmin@$domonly\nYour password is: $password" 10 108
|
||||
whiptail --title "Credits" --msgbox " Made by: your local Wizard and God" 8 78
|
||||
clear
|
||||
clear
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user