From 93239f93d5541f6964c96fc54159ccc70610afa2 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Thu, 15 Apr 2021 12:49:54 -0700 Subject: [PATCH] installer updates --- bin/vmail-installer.sh | 75 ------------------------------------------ install.sh | 7 ++-- update.sh | 6 ++++ 3 files changed, 10 insertions(+), 78 deletions(-) delete mode 100755 bin/vmail-installer.sh diff --git a/bin/vmail-installer.sh b/bin/vmail-installer.sh deleted file mode 100755 index 693d71d..0000000 --- a/bin/vmail-installer.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -echo 'installing vmail-stack now!' - -apt -y install mariadb-client mariadb-server -## config mariadb - -apt -y install apache2 libapache2-mod-authnz-pam libwww-perl php-fpm php-cli php-ssh2 php-curl php-dev php-enchant php-mysql php-pear php-gd php-http php-imap php-intl php-mysql php-yaml php-propro php-pspell php-raphf php-ssh2 php-sqlite3 php-tidy php-xml php-xmlrpc php-zip php-mbstring php-imagick php-redis redis pwauth libapache2-mod-authnz-external -## adjust above package list -a2enmod rewrite headers expires ssl http2 macro -# configure mod_macro - -# configure php - -# configure apache security - -## below needs to be cleaned up (remove 'stack' stuff) -# mail stack -apt -y --install-suggests install spamassassin libclass-dbi-mysql-perl -apt -y install exim4-daemon-heavy spf-tools-perl dovecot-core dovecot-imapd dovecot-mysql dovecot-pop3d dovecot-lmtpd -usermod -a -G ssl-cert Debian-exim -groupadd --gid 500 vmail -useradd --create-home --home-dir /var/vmail --shell /bin/false --uid 500 --gid 500 vmail -chmod 750 /var/vmail/ -mkdir /etc/ssl/dkim -chown Debian-exim:ssl-cert /etc/ssl/dkim -chmod 750 /etc/ssl/dkim -sed -i 's/size 10M/daily/g' /etc/logrotate.d/exim4-paniclog -# # chown Debian-exim:Debian-exim /etc/exim4/autowhitelist.filter -# # chmod 640 /etc/exim4/autowhitelist.filter -mysqladmin create vmail -## fix this path -mysql < .../vmail.sql -VMAILPASS=`pwgen -1 12` -mysql -e "CREATE USER 'vmail'@'localhost' IDENTIFIED BY '$VMAILPASS';" -mysql -e "GRANT ALL PRIVILEGES ON vmail.* TO 'vmail'@'localhost';" -# spamassassin config -sed -i "s|userpref|sa_userpref|g" /usr/share/doc/spamassassin/sql/userpref_mysql.sql -sed -i "s|username varchar(100)|username varchar(255)|g" /usr/share/doc/spamassassin/sql/userpref_mysql.sql -sed -i "s|TYPE=MyISAM||g" /usr/share/doc/spamassassin/sql/userpref_mysql.sql -mysql vmail < /usr/share/doc/spamassassin/sql/userpref_mysql.sql -sed -i 's|OPTIONS="--create-prefs --max-children 5 --helper-home-dir"|OPTIONS="-x -q -v -u Debian-exim -m 5"|g' /etc/default/spamassassin -sed -i 's|CRON=0|CRON=1|g' /etc/default/spamassassin -systemctl enable spamassassin.service -cp /opt/stack/server_configs/etc/spamassassin/* /etc/spamassassin/ -sed -i "s|user_scores_sql_password password|user_scores_sql_password $VMAILPASS|g" /etc/spamassassin/sql.cf -chown root:root /etc/spamassassin/local.cf -chmod 644 /etc/spamassassin/local.cf -chown debian-spamd:mail /etc/spamassassin/sql.cf -chmod 640 /etc/spamassassin/sql.cf -service spamassassin restart -# exim config -install --owner=Debian-exim --group=Debian-exim --mode=640 /dev/null /etc/exim4/relay_domains -cp /opt/stack/server_configs/etc/exim4/* /etc/exim4/ -chown Debian-exim:Debian-exim /etc/exim4/autowhitelist.filter -chown Debian-exim:Debian-exim /etc/exim4/return-resender.sh -chown Debian-exim:Debian-exim /etc/exim4/skip_greylisting_hosts -sed -i "s|password|$VMAILPASS|g" /etc/exim4/exim_local.conf -service exim4 restart -# dovecot config -mkdir /etc/dovecot/sites.d -cp -a /opt/stack/server_configs/etc/dovecot/* /etc/dovecot/ -chgrp dovecot /etc/dovecot/dovecot-sql.conf.ext -sed -i "s|password=password|password=$VMAILPASS|g" /etc/dovecot/dovecot-sql.conf.ext -cp -a /opt/stack/server_configs/usr/local/sbin/vmail-quota-warning.sh /usr/local/sbin/ -chmod 750 /usr/local/sbin/vmail-quota-warning.sh -chown dovecot:mail /usr/local/sbin/vmail-quota-warning.sh -service dovecot restart - - -# set webmail password -sed -i "s|vmail:password@localhost|vmail:$VMAILPASS@localhost|g" /var/www/html/webmail/config/config.inc.php -sed -i "s|vmail:password@localhost|vmail:$VMAILPASS@localhost|g" /var/www/html/webmail/plugins/sauserprefs/config.inc.php - -# Let's Encrypt diff --git a/install.sh b/install.sh index 950167e..42254f4 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ "${EUID}" -ne 0 ]; then - echo "This script must be run as root" + echo "You must be root to run this installer." exit fi @@ -28,7 +28,7 @@ if [ -d "/etc/exim4/" ] || [ -d "/etc/dovecot/" ]; then sleep 5 fi -# install pwgen, used to create randmo passwords +# install pwgen, used to create random passwords apt -y install pwgen # install mariadb (mysql) @@ -60,6 +60,7 @@ mysqladmin flush-privileges apt -y install exim4-daemon-heavy spf-tools-perl spamassassin libclass-dbi-mysql-perl dovecot-core dovecot-imapd dovecot-mysql dovecot-pop3d dovecot-lmtpd # configure system users +apt -y install ssl-cert usermod -a -G ssl-cert Debian-exim useradd --create-home --home-dir /var/vmail --shell /usr/sbin/nologin --system --user-group vmail @@ -113,7 +114,7 @@ cp -a etc/dovecot/* /etc/dovecot/ chgrp dovecot /etc/dovecot/dovecot-sql.conf.ext chmod 640 /etc/dovecot/dovecot-sql.conf.ext sed -i "s|password=password|password=$VMAILPASS|g" /etc/dovecot/dovecot-sql.conf.ext -cp -a libexec/vmail-quota-warning.sh /usr/libexec/ +cp libexec/vmail-quota-warning.sh /usr/libexec/ chmod 750 /usr/libexec/vmail-quota-warning.sh chown dovecot:mail /usr/libexec/vmail-quota-warning.sh diff --git a/update.sh b/update.sh index e59c122..9cd989a 100755 --- a/update.sh +++ b/update.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [ "${EUID}" -ne 0 ]; then + echo "You must be root to run this installer." + exit +fi + # update repo git pull @@ -45,3 +50,4 @@ if ! diff -q libexec/vmail-quota-warning.sh /usr/libexec/vmail-quota-warning.sh echo "/usr/libexec/vmail-quota-warning.sh updated" echo fi +