From 3a9c8b7588dbb75ac622e1bf76c25dc1e20b7ed1 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Wed, 31 Mar 2021 11:00:02 -0700 Subject: [PATCH] add vmail_macro --- etc/apache2/conf-available/vmail_macro.conf | 20 ++++++++++++++++++++ install.sh | 21 +++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 etc/apache2/conf-available/vmail_macro.conf diff --git a/etc/apache2/conf-available/vmail_macro.conf b/etc/apache2/conf-available/vmail_macro.conf new file mode 100644 index 0000000..6bd025e --- /dev/null +++ b/etc/apache2/conf-available/vmail_macro.conf @@ -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 + + + ServerName $vhost + + + Redirect / https://$vhost + + + + + ServerName $vhost + DocumentRoot /srv/www/html/roundcubemail/ + SSLEngine on + SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem + + + diff --git a/install.sh b/install.sh index 3604923..b418421 100755 --- a/install.sh +++ b/install.sh @@ -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