installer updates

This commit is contained in:
Matthew Saunders Brown 2021-04-15 12:49:54 -07:00
parent dc36299dd1
commit 93239f93d5
3 changed files with 10 additions and 78 deletions

View File

@ -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

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [ "${EUID}" -ne 0 ]; then if [ "${EUID}" -ne 0 ]; then
echo "This script must be run as root" echo "You must be root to run this installer."
exit exit
fi fi
@ -28,7 +28,7 @@ if [ -d "/etc/exim4/" ] || [ -d "/etc/dovecot/" ]; then
sleep 5 sleep 5
fi fi
# install pwgen, used to create randmo passwords # install pwgen, used to create random passwords
apt -y install pwgen apt -y install pwgen
# install mariadb (mysql) # 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 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 # configure system users
apt -y install ssl-cert
usermod -a -G ssl-cert Debian-exim usermod -a -G ssl-cert Debian-exim
useradd --create-home --home-dir /var/vmail --shell /usr/sbin/nologin --system --user-group vmail 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 chgrp dovecot /etc/dovecot/dovecot-sql.conf.ext
chmod 640 /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 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 chmod 750 /usr/libexec/vmail-quota-warning.sh
chown dovecot:mail /usr/libexec/vmail-quota-warning.sh chown dovecot:mail /usr/libexec/vmail-quota-warning.sh

View File

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
if [ "${EUID}" -ne 0 ]; then
echo "You must be root to run this installer."
exit
fi
# update repo # update repo
git pull 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 "/usr/libexec/vmail-quota-warning.sh updated"
echo echo
fi fi