add vmail_macro

This commit is contained in:
Matthew Saunders Brown 2021-03-31 11:00:02 -07:00
parent 7329e48577
commit 3a9c8b7588
2 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,20 @@
# VMailHTTPS for roundcubemail webmail at mail. subdomain assumes & requires https w/ valid cert
# Webmail - HTTP Port 80 Redirects to HTTPS Port 443
<Macro VMailHTTPS $vhost>
<VirtualHost *:80>
ServerName $vhost
<Location "/">
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
Redirect / https://$vhost
</If>
</Location>
</VirtualHost>
<VirtualHost *:443>
ServerName $vhost
DocumentRoot /srv/www/html/roundcubemail/
SSLEngine on
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
</VirtualHost>
</Macro>

View File

@ -66,9 +66,17 @@ mysqladmin flush-privileges
if [ ! -d "/etc/apache2/" ]; then
apt -y install apache2
fi
cp etc/apache2/conf-available/vmail_macro.conf /etc/apache2/conf-available/vmail_macro.conf
chmod 644 /etc/apache2/conf-available/vmail_macro.conf
a2enmod macro
a2enconf vmail_macro
# install php
apt -y install php-fpm php-cli php-gd php-imagick php-imap php-intl php-mysql php-pspell php-zip
a2enconf php7.4-fpm
sed -i "s|post_max_size = 8M|post_max_size = 256M|g" /etc/php/7.4/fpm/php.ini
sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 256M|g" /etc/php/7.4/fpm/php.ini
sed -i "s|pm = dynamic|pm = ondemand|g" /etc/php/7.4/fpm/pool.d/www.conf
# install mail server software
apt -y install exim4-daemon-heavy spf-tools-perl spamassassin libclass-dbi-mysql-perl dovecot-core dovecot-imapd dovecot-mysql dovecot-pop3d dovecot-lmtpd
@ -101,14 +109,12 @@ 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 etc/spamassassin/*.cf /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
sed -i 's/size 10M/daily/g' /etc/logrotate.d/exim4-paniclog
@ -122,7 +128,6 @@ chmod 640 /etc/exim4/return-resender.sh
chown Debian-exim:Debian-exim /etc/exim4/skip_greylisting_hosts
chmod 640 /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
@ -133,7 +138,14 @@ sed -i "s|password=password|password=$VMAILPASS|g" /etc/dovecot/dovecot-sql.conf
cp -a libexec/vmail-quota-warning.sh /usr/libexec/
chmod 750 /usr/libexec/vmail-quota-warning.sh
chown dovecot:mail /usr/libexec/vmail-quota-warning.sh
service dovecot restart
# restart services
systemctl enable spamassassin
systemctl restart spamassassin
systemctl restart exim4
systemctl restart php7.4-fpm
systemctl restart apache2
systemctl restart dovecot
chmod 755 bin/*
cp bin/* /usr/local/bin/
@ -144,6 +156,7 @@ wget --continue --quiet https://github.com/roundcube/roundcubemail/releases/down
tar zxf roundcubemail-1.4.11-complete.tar.gz
cd roundcubemail-1.4.11
pwd
# apache_document_root=`apachectl -t -D DUMP_RUN_CFG|grep DocumentRoot|cut -d \" -f 2`
# config
# change product_name as desired
# change support_url