Updated menu; quiet output

This commit is contained in:
b.waal
2019-09-15 18:50:06 +02:00
parent 5e1d78ae11
commit 82cb96f7bb

View File

@@ -233,27 +233,27 @@ systemctl restart nginx
##-----------------------##
whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45
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 >/dev/null
source /tmp/mysql-8.0.sh
##------------------------------##
# MySQL_Secure_Installation #
##------------------------------##
whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45
mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')" >/dev/null
mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User=''" >/dev/null
mysql -u root -p"$password" -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'" >/dev/null
mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" >/dev/null
mysql -u root -p"$password" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$password"';" >/dev/null
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" >/dev/null
mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')" $OUTPUT
mysql -u root -p"$password" -e "DELETE FROM mysql.user WHERE User=''" $OUTPUT
mysql -u root -p"$password" -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'" $OUTPUT
mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" $OUTPUT
mysql -u root -p"$password" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$password"';" $OUTPUT
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" $OUTPUT
##-----------------------------##
# MySQL Database Creation #
##-----------------------------##
whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45
mysql -u root -p"$password" -e "CREATE DATABASE postfixadmin;" >/dev/null
mysql -u root -p"$password" -e "CREATE USER '"postfixadmin"'@'localhost' IDENTIFIED BY '"$password"';" >/dev/null
mysql -u root -p"$password" -e "GRANT ALL ON "postfixadmin".* TO "postfixadmin"@'localhost';" >/dev/null
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" >/dev/null
mysql -u root -p"$password" -e "CREATE DATABASE postfixadmin;" $OUTPUT
mysql -u root -p"$password" -e "CREATE USER '"postfixadmin"'@'localhost' IDENTIFIED BY '"$password"';" $OUTPUT
mysql -u root -p"$password" -e "GRANT ALL ON "postfixadmin".* TO "postfixadmin"@'localhost';" $OUTPUT
mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" $OUTPUT
##------------------##
# PostfixADMIN #
@@ -263,15 +263,15 @@ $PKGI libc-client2007e mlock php${phpver}-common php${phpver}-imap
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
tar -xf /tmp/postfixadmin.tar.gz -C /var/www/"$domain"/html/postfixadmin --strip-components=1 $OUTPUT
chmod 755 -R /var/www/"$domain"/html/postfixadmin/templates_c
chown -R www-data: /var/www/"$domain"/html/
wget -q -t7 https://git.ictmaatwerk.com/VPS-scripts/Ubuntu-Mail/raw/branch/"$branch"/config/postfixadmin/config.local.php -O /var/www/$domain/html/postfixadmin/config.local.php
sed -i -e 's/PASSword/'$password'/' -e 's/dOmaINnamE/'$domonly'/' /var/www/"$domain"/html/postfixadmin/config.local.php
sudo -u www-data php /var/www/"$domain"/html/postfixadmin/upgrade.php >/dev/null
bash /var/www/"$domain"/html/postfixadmin/scripts/postfixadmin-cli admin add superadmin@"$domonly" --superadmin 1 --active 1 --password "$password" --password2 "$password" >/dev/null
groupadd -g 5000 vmail >/dev/null
useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail >/dev/null
sudo -u www-data php /var/www/"$domain"/html/postfixadmin/upgrade.php $OUTPUT
bash /var/www/"$domain"/html/postfixadmin/scripts/postfixadmin-cli admin add superadmin@"$domonly" --superadmin 1 --active 1 --password "$password" --password2 "$password" $OUTPUT
groupadd -g 5000 vmail $OUTPUT
useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail $OUTPUT
##--------------------##
# Certbot (Auto) #
@@ -284,7 +284,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail >/dev/
#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"
#sed -i 's#include /etc/letsencrypt/options-ssl-nginx.conf;#ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;#g' /etc/nginx/sites-available/"$domain"
#openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam"
#openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam" $OUTPUT
#chmod 777 -R /etc/ssl/certs/dhparam.pem
##----------------------##
@@ -300,8 +300,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" > /dev/null 2>&1
openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem "$dhparam" > /dev/null 2>&1
openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam" $OUTPUT
openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem "$dhparam" $OUTPUT
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
@@ -396,8 +396,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/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 >/dev/null
chgrp dovecot /etc/dovecot/sieve/default.svbin >/dev/null
sievec /etc/dovecot/sieve/default.sieve $OUTPUT
chgrp dovecot /etc/dovecot/sieve/default.svbin $OUTPUT
##------------------##
# Spamassassin #
@@ -478,7 +478,7 @@ $PKGI unzip
whiptail --title "Configuring Rainloop" --infobox "Busy like a bee" 8 45
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 > /dev/null 2>&1
source /tmp/rainloop.sh $OUTPUT
ln -s /opt/rainloop /var/www/"$domain"/html/
##--------------##
@@ -492,7 +492,7 @@ 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/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 > /dev/null 2>&1
systemctl restart fail2ban $OUTPUT
##---------------------------------##
# Unattended Security Updates #
@@ -505,14 +505,14 @@ source /tmp/unattended.sh
##-----------------------##
whiptail --title "Enabling Services" --infobox "Busy like a bee" 8 45
sleep 2
systemctl enable nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent > /dev/null 2>&1
systemctl enable nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent $OUTPUT
##-----------------------##
# Starting Services #
##-----------------------##
whiptail --title "Restarting Services" --infobox "Busy like a bee" 8 45
sleep 2
systemctl restart nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent > /dev/null 2>&1
systemctl restart nginx mysql postfix postfix@- dovecot fail2ban clamav-daemon clamav-freshclam clamsmtp spamassassin amavisd-snmp-subagent amavis-mc amavis-snmp-subagent $OUTPUT
##------------------##
# Final Update #