Browse Source

Enhance mail configuration (#815)

* Enable Roundcube plugins and few tweaks
* ZipDownload Roundcube Plugin
* Newmail Notifier Roundcube Plugin
* Enable Roundcube plugins
* HELO support for multiple domains and IPs
* Generating list of mail domains for HELO
* Update CHANGELOG.md
* Add cosmetic new line to eof.

Co-authored-by: Raphael Schneeberger <rs@scit.ch>
Alexandros Ioannides 5 years ago
parent
commit
1718ccdda5

+ 2 - 0
CHANGELOG.md

@@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file.
 - Added support for Ubuntu Server 20.04 LTS.
 - Added the ability to set the php cli version per user (using alias).
 - Added support for resolving ip addresses based on geoip database for Awstats
+- Added Roundcube plugins newmail_notifier and zipdownload.
+- Added HELO support for multiple domains and IPs.
 
 ### Bugfixes
 - Do not allow to show apache2 server-status page from public.

+ 4 - 0
bin/v-add-mail-domain

@@ -65,6 +65,10 @@ else
     get_user_ip
 fi
 
+# Generating list of mail domains for HELO
+ls /etc/exim4/domains > /etc/exim4/mailhelo.conf
+sed -i "s \(.*\) \1:\1 " /etc/exim4/mailhelo.conf
+        
 # Generating timestamp
 new_timestamp
 

+ 4 - 0
bin/v-delete-mail-domain

@@ -85,6 +85,10 @@ rm -f $USER_DATA/mail/$domain.pem
 rm -f $USER_DATA/mail/$domain.pub
 rm -f $USER_DATA/mail/*@$domain.msg
 
+# Generating list of mail domains for HELO
+ls /etc/exim4/domains > /etc/exim4/mailhelo.conf
+sed -i "s \(.*\) \1:\1 " /etc/exim4/mailhelo.conf
+
 # Decreasing domain value
 decrease_user_value "$user" '$U_MAIL_DOMAINS'
 if [ "$DKIM" = 'yes' ]; then

+ 8 - 4
func/rebuild.sh

@@ -497,11 +497,15 @@ rebuild_mail_domain_conf() {
         touch $HOMEDIR/$user/conf/mail/$domain/passwd
         touch $HOMEDIR/$user/conf/mail/$domain/fwd_only
 
-        # Seeting outgoing ip address
+        # Setting outgoing ip address
         if [ ! -z "$local_ip" ]; then
             echo "$local_ip" > $HOMEDIR/$user/conf/mail/$domain/ip
         fi
 
+        # Generating list of mail domains for HELO
+        ls /etc/exim4/domains > /etc/exim4/mailhelo.conf
+        sed -i "s \(.*\) \1:\1 " /etc/exim4/mailhelo.conf
+
         # Adding antispam protection
         if [ "$ANTISPAM" = 'yes' ]; then
             touch $HOMEDIR/$user/conf/mail/$domain/antispam
@@ -524,7 +528,7 @@ rebuild_mail_domain_conf() {
             rm -f /etc/dovecot/conf.d/domains/$domain_idn.conf
         fi
 
-        # Adding mail directiry
+        # Adding mail directory
         if [ ! -e $HOMEDIR/$user/mail/$domain_idn ]; then
             mkdir "$HOMEDIR/$user/mail/$domain_idn"
         fi
@@ -590,8 +594,8 @@ rebuild_mail_domain_conf() {
     sslcheck=$(grep "DOMAIN='$domain'" $USER_DATA/mail.conf | grep SSL)
     if [ -z "$sslcheck" ]; then
         sed -i "s|$domain'|$domain' SSL='no' LETSENCRYPT='no'|g" $USER_DATA/mail.conf
-    fi 
-    
+    fi
+
     # Remove and recreate SSL configuration
     if [ -f "$HOMEDIR/$user/conf/mail/$domain/ssl/$domain.crt" ]; then
         del_mail_ssl_config

+ 1 - 1
install/deb/exim/exim4.conf.template

@@ -325,7 +325,7 @@ begin transports
 
 remote_smtp:
   driver = smtp
-  helo_data = ${primary_hostname}
+  helo_data = ${if exists {/etc/exim4/mailhelo.conf}{${lookup{$sender_address_domain}lsearch*{/etc/exim4/mailhelo.conf}{$value}{$primary_hostname}}}{$primary_hostname}}
   dkim_domain = DKIM_DOMAIN
   dkim_selector = mail
   dkim_private_key = DKIM_PRIVATE_KEY

+ 3 - 3
install/deb/roundcube/main.inc.php

@@ -377,7 +377,7 @@ $rcmail_config['email_dns_check'] = false;
 // ----------------------------------
 
 // List of active plugins (in plugins/ directory)
-$rcmail_config['plugins'] = array('password');
+$rcmail_config['plugins'] = array('password','newmail_notifier','zipdownload');
 
 // ----------------------------------
 // USER INTERFACE
@@ -715,11 +715,11 @@ $rcmail_config['prefer_html'] = true;
 // 0 - Never, always ask
 // 1 - Ask if sender is not in address book
 // 2 - Always show inline images
-$rcmail_config['show_images'] = 0;
+$rcmail_config['show_images'] = 1;
 
 // compose html formatted messages by default
 // 0 - never, 1 - always, 2 - on reply to HTML message only 
-$rcmail_config['htmleditor'] = 0;
+$rcmail_config['htmleditor'] = 1;
 
 // show pretty dates as standard
 $rcmail_config['prettydate'] = true;

+ 15 - 0
install/deb/roundcube/plugins/config_newmail_notifier.inc.php

@@ -0,0 +1,15 @@
+<?php
+
+// Enables basic notification
+$config['newmail_notifier_basic'] = true;
+
+// Enables sound notification
+$config['newmail_notifier_sound'] = false;
+
+// Enables desktop notification
+$config['newmail_notifier_desktop'] = false;
+
+// Desktop notification close timeout in seconds
+$config['newmail_notifier_desktop_timeout'] = 5;
+
+?>

+ 21 - 0
install/deb/roundcube/plugins/config_zipdownload.inc.php

@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * ZipDownload configuration file
+ */
+
+// Zip attachments
+// Only show the link when there are more than this many attachments
+// -1 to prevent downloading of attachments as zip
+$config['zipdownload_attachments'] = 1;
+
+// Zip selection of mail messages
+// This option enables downloading of multiple messages as one zip archive.
+// The number or string value specifies maximum total size of all messages
+// in the archive (not the size of the archive itself).
+$config['zipdownload_selection'] = '100MB';
+
+// Charset to use for filenames inside the zip
+$config['zipdownload_charset'] = 'ISO-8859-1';
+
+?>

+ 4 - 0
install/hst-install-debian.sh

@@ -1604,6 +1604,10 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
         fi
     fi
     
+    # Enable Roundcube plugins
+    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_newmail_notifier.inc.php /etc/roundcube/plugins/newmail_notifier/config.inc.php
+    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_zipdownload.inc.php /etc/roundcube/plugins/zipdownload/config.inc.php
+    
     # Fixes for PHP 7.4 compatibility
     sed -i 's/\"\\n\", $identities/$identities, \"\\n\"/g' /usr/share/roundcube/plugins/enigma/lib/enigma_ui.php
     sed -i 's/(array_keys($post_search), \x27|\x27)/(\x27|\x27, array_keys($post_search))/g' /usr/share/roundcube/program/lib/Roundcube/rcube_contacts.php

+ 4 - 0
install/hst-install-ubuntu.sh

@@ -1549,6 +1549,10 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
     sed -i "s/localhost/$servername/g" /etc/roundcube/plugins/password/config.inc.php
     mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
 
+    # Enable Roundcube plugins
+    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_newmail_notifier.inc.php /etc/roundcube/plugins/newmail_notifier/config.inc.php
+    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_zipdownload.inc.php /etc/roundcube/plugins/zipdownload/config.inc.php
+    
     # Fixes for PHP 7.4 compatibility
     sed -i 's/\"\\n\", $identities/$identities, \"\\n\"/g' /usr/share/roundcube/plugins/enigma/lib/enigma_ui.php
     sed -i 's/(array_keys($post_search), \x27|\x27)/(\x27|\x27, array_keys($post_search))/g' /usr/share/roundcube/program/lib/Roundcube/rcube_contacts.php

+ 13 - 0
install/upgrade/versions/latest.sh

@@ -31,6 +31,7 @@ fi
 
 # Roundcube fixes for PHP 7.4 compatibility
 if [ -d /usr/share/roundcube ]; then
+    echo "(*) Updating Roundcube configuration..."
     sed -i 's/\"\\n\", $identities/$identities, \"\\n\"/g' /usr/share/roundcube/plugins/enigma/lib/enigma_ui.php
     sed -i 's/(array_keys($post_search), \x27|\x27)/(\x27|\x27, array_keys($post_search))/g' /usr/share/roundcube/program/lib/Roundcube/rcube_contacts.php
     sed -i 's/implode($name, \x27.\x27)/implode(\x27.\x27, $name)/g' /usr/share/roundcube/program/lib/Roundcube/rcube_db.php
@@ -39,6 +40,18 @@ if [ -d /usr/share/roundcube ]; then
     sed -i 's/implode($bstyle, \x27; \x27)/implode(\x27; \x27, $bstyle)/g' /usr/share/roundcube/program/steps/mail/sendmail.inc
 fi
 
+# Enable Roundcube plugins
+if [ -d /usr/share/roundcube ]; then
+    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_newmail_notifier.inc.php /etc/roundcube/plugins/newmail_notifier/config.inc.php
+    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_zipdownload.inc.php /etc/roundcube/plugins/zipdownload/config.inc.php
+    sed -i "s/array('password')/array('password','newmail_notifier','zipdownload')/g" /etc/roundcube/config.inc.php
+fi
+
+# HELO support for multiple domains and IPs
+if [ -e "/etc/exim4/exim4.conf.template" ]; then
+    echo "(*) Updating exim4 configuration..."
+    sed -i 's|helo_data = ${primary_hostname}|helo_data = ${if exists {\/etc\/exim4\/mailhelo.conf}{${lookup{$sender_address_domain}lsearch*{\/etc\/exim4\/mailhelo.conf}{$value}{$primary_hostname}}}{$primary_hostname}}|g' /etc/exim4/exim4.conf.template
+fi
 
 # Add daily midnight cron
 if [ -z "$($BIN/v-list-cron-jobs admin | grep 'v-update-sys-queue daily')" ]; then