From b4f676001ebdaee31e3bf4a4e46fcaef10c1943d Mon Sep 17 00:00:00 2001 From: bprieshof Date: Sun, 15 Sep 2019 19:26:12 +0200 Subject: [PATCH] Updated Debug output --- installer.sh | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/installer.sh b/installer.sh index f5bc82a..7444340 100644 --- a/installer.sh +++ b/installer.sh @@ -10,14 +10,14 @@ PKGM="apt" if [ "$1" != "-l" ]; then echo "Normal mode" PKGM="debconf-apt-progress -- apt" - OUTPUT="> /dev/null 2>&1" + OUTPUT='/dev/null' IMODE=n fi if [ "$1" = "-l" ]; then echo "Legacy mode"; PKGM="apt" - OUTPUT="" + OUTPUT='/dev/tty' IMODE=l fi PKGA="add-apt-repository" @@ -239,21 +239,21 @@ 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')" $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 -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 +mysql -u root -p"$password" -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "SELECT user,authentication_string,plugin,host FROM mysql.user;" $> $OUTPUT 2>&1 +mysql -u root -p"$password" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '"$password"';" > $OUTPUT 2>&1 +mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 ##-----------------------------## # MySQL Database Creation # ##-----------------------------## whiptail --title "Installing MySQL" --infobox "Busy like a bee" 8 45 -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 +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 +mysql -u root -p"$password" -e "FLUSH PRIVILEGES;" > $OUTPUT 2>&1 ##------------------## # 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 $OUTPUT +tar -xf /tmp/postfixadmin.tar.gz -C /var/www/"$domain"/html/postfixadmin --strip-components=1 $> $OUTPUT 2>&1 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 $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 +sudo -u www-data php /var/www/"$domain"/html/postfixadmin/upgrade.php > $OUTPUT 2>&1 +bash /var/www/"$domain"/html/postfixadmin/scripts/postfixadmin-cli admin add superadmin@"$domonly" --superadmin 1 --active 1 --password "$password" --password2 "$password" > $OUTPUT 2>&1 +groupadd -g 5000 vmail > $OUTPUT 2>&1 +useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail > $OUTPUT 2>&1 ##--------------------## # Certbot (Auto) # @@ -284,7 +284,7 @@ useradd -u 5000 -g vmail -s /usr/sbin/nologin -d /var/mail/vmail -m vmail $OUTPU #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" $OUTPUT +#openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam" > $OUTPUT 2>&1 #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" $OUTPUT -openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem "$dhparam" $OUTPUT +openssl dhparam -out /etc/ssl/certs/dhparam.pem "$dhparam" > $OUTPUT 2>&1 +openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem "$dhparam" > $OUTPUT 2>&1 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 $OUTPUT -chgrp dovecot /etc/dovecot/sieve/default.svbin $OUTPUT +sievec /etc/dovecot/sieve/default.sieve > $OUTPUT 2>&1 +chgrp dovecot /etc/dovecot/sieve/default.svbin > $OUTPUT 2>&1 ##------------------## # 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 $OUTPUT +source /tmp/rainloop.sh > $OUTPUT 2>&1 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 $OUTPUT +systemctl restart fail2ban > $OUTPUT 2>&1 ##---------------------------------## # 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 $OUTPUT +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 # ##-----------------------## 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 $OUTPUT +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 #