Parcourir la source

OSAL_PATH_EXIM_CONF holds full path to exim config file and remove OS dependent blocks

Robert Zollner il y a 5 ans
Parent
commit
49d1ba3ab9

+ 2 - 8
bin/module/clamav/exim-integration/disable.inc

@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 
 hestia_module_clamav_exim-integration_disable() {
 hestia_module_clamav_exim-integration_disable() {
     source $HESTIA/bin/module/func.inc
     source $HESTIA/bin/module/func.inc
@@ -16,13 +16,7 @@ hestia_module_clamav_exim-integration_disable() {
     fi
     fi
 
 
     echo "Disabling Exim-ClamAV integration..."
     echo "Disabling Exim-ClamAV integration..."
-
-
-    if [ "$OS_BASE" = 'debian' ]; then
-        /usr/bin/sed -i "/^CLAMD\s*=\s*/ s/^/#/" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-    else
-        /usr/bin/sed -i "/^CLAMD\s*=\s*/ s/^/#/" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-    fi
+    /usr/bin/sed -i "/^CLAMD\s*=\s*/ s/^/#/" "${OSAL_PATH_EXIM_CONF}"
     
     
     osal_service_restart $OSAL_SERVICE_EXIM
     osal_service_restart $OSAL_SERVICE_EXIM
     check_result $? "Exim restart failed"
     check_result $? "Exim restart failed"

+ 1 - 6
bin/module/clamav/exim-integration/enable.inc

@@ -16,12 +16,7 @@ hestia_module_clamav_exim-integration_enable() {
     fi
     fi
 
 
     echo "Enabling Exim-ClamAV integration..."
     echo "Enabling Exim-ClamAV integration..."
-
-    if [ "$OS_BASE" = 'debian' ]; then
-        /usr/bin/sed -i "/^#CLAMD\s*=\s*/ s/#*//" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-    else
-        /usr/bin/sed -i "/^#CLAMD\s*=\s*/ s/#*//" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-    fi
+    /usr/bin/sed -i "/^#CLAMD\s*=\s*/ s/#*//" "${OSAL_PATH_EXIM_CONF}"
 
 
     gpasswd -a clamav mail > /dev/null 2>&1
     gpasswd -a clamav mail > /dev/null 2>&1
     gpasswd -a clamav $OSAL_USER_EXIM > /dev/null 2>&1
     gpasswd -a clamav $OSAL_USER_EXIM > /dev/null 2>&1

+ 9 - 14
bin/module/exim/install.inc

@@ -12,28 +12,23 @@ hestia_module_exim_install() {
     echo "Installing MTA (Exim) module..."
     echo "Installing MTA (Exim) module..."
 
 
     osal_service_stop $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_stop $OSAL_SERVICE_EXIM > /dev/null 2>&1
-    hestia_config_backup 'exim-install' $OSAL_PATH_EXIM_CONF
+    hestia_config_backup 'exim-install' $OSAL_DIR_EXIM_CONF
 
 
     osal_package_preinstall
     osal_package_preinstall
     osal_package_install $OSAL_PKG_EXIM
     osal_package_install $OSAL_PKG_EXIM
 
 
     gpasswd -a $OSAL_USER_EXIM mail > /dev/null 2>&1
     gpasswd -a $OSAL_USER_EXIM mail > /dev/null 2>&1
 
 
-    if [ "$OS_BASE" = 'debian' ]; then
-        cp -f $HESTIA_INSTALL_DIR/exim/${OSAL_PKG_EXIM}.conf.template $OSAL_PATH_EXIM_CONF/
-        chmod 640 $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-    else
-        cp -f $HESTIA_INSTALL_DIR/exim/${OSAL_PKG_EXIM}.conf $OSAL_PATH_EXIM_CONF/
-        chmod 640 $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-    fi
+    cp -f $HESTIA_INSTALL_DIR/exim/${OSAL_FILENAME_EXIM_CONF} "$OSAL_PATH_EXIM_CONF"
+    chmod 640 "$OSAL_PATH_EXIM_CONF"
 
 
-    cp -f $HESTIA_INSTALL_DIR/exim/dnsbl.conf $OSAL_PATH_EXIM_CONF/
-    cp -f $HESTIA_INSTALL_DIR/exim/spam-blocks.conf $OSAL_PATH_EXIM_CONF/
-    touch $OSAL_PATH_EXIM_CONF/white-blocks.conf
-    touch $OSAL_PATH_EXIM_CONF/mailhelo.conf
+    cp -f $HESTIA_INSTALL_DIR/exim/dnsbl.conf $OSAL_DIR_EXIM_CONF/
+    cp -f $HESTIA_INSTALL_DIR/exim/spam-blocks.conf $OSAL_DIR_EXIM_CONF/
+    touch $OSAL_DIR_EXIM_CONF/white-blocks.conf
+    touch $OSAL_DIR_EXIM_CONF/mailhelo.conf
 
 
-    rm -rf $OSAL_PATH_EXIM_CONF/domains
-    mkdir -p $OSAL_PATH_EXIM_CONF/domains
+    rm -rf $OSAL_DIR_EXIM_CONF/domains
+    mkdir -p $OSAL_DIR_EXIM_CONF/domains
 
 
     rm -f /etc/alternatives/mta
     rm -f /etc/alternatives/mta
     ln -s /usr/sbin/$OSAL_PKG_EXIM /etc/alternatives/mta
     ln -s /usr/sbin/$OSAL_PKG_EXIM /etc/alternatives/mta

+ 1 - 1
bin/module/exim/remove.inc

@@ -30,7 +30,7 @@ hestia_module_exim_remove() {
     osal_service_stop $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_stop $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_disable $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_disable $OSAL_SERVICE_EXIM > /dev/null 2>&1
 
 
-    hestia_config_backup 'exim-remove' $OSAL_PATH_EXIM_CONF
+    hestia_config_backup 'exim-remove' "$OSAL_DIR_EXIM_CONF"
 
 
     osal_package_remove $OSAL_PKG_EXIM
     osal_package_remove $OSAL_PKG_EXIM
 
 

+ 1 - 1
bin/module/mariadb/remove.inc

@@ -30,7 +30,7 @@ hestia_module_exim_remove() {
     osal_service_stop $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_stop $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_disable $OSAL_SERVICE_EXIM > /dev/null 2>&1
     osal_service_disable $OSAL_SERVICE_EXIM > /dev/null 2>&1
 
 
-    hestia_config_backup 'exim-remove' $OSAL_PATH_EXIM_CONF
+    hestia_config_backup 'exim-remove' "$OSAL_DIR_EXIM_CONF"
 
 
     osal_package_remove $OSAL_PKG_EXIM
     osal_package_remove $OSAL_PKG_EXIM
 
 

+ 2 - 8
bin/module/spamassassin/exim-integration/disable.inc

@@ -16,14 +16,8 @@ hestia_module_spamassassin_exim-integration_disable() {
     fi
     fi
 
 
     echo "Disabling SpamAssassin-Exim integration..."
     echo "Disabling SpamAssassin-Exim integration..."
-
-    if [ "$OS_BASE" = 'debian' ]; then
-        /usr/bin/sed -i "/^SPAMASSASSIN\s*=\s*/ s/^/#/" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-        /usr/bin/sed -i "/^SPAM_SCORE\s*=\s*/ s/^/#/" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-    else
-        /usr/bin/sed -i "/^SPAMASSASSIN\s*=\s*/ s/^/#/" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-        /usr/bin/sed -i "/^SPAM_SCORE\s*=\s*/ s/^/#/" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-    fi
+    /usr/bin/sed -i "/^SPAMASSASSIN\s*=\s*/ s/^/#/" "$OSAL_PATH_EXIM_CONF"
+    /usr/bin/sed -i "/^SPAM_SCORE\s*=\s*/ s/^/#/" "$OSAL_PATH_EXIM_CONF"
 
 
     osal_service_restart $OSAL_SERVICE_EXIM
     osal_service_restart $OSAL_SERVICE_EXIM
     check_result $? "Exim restart failed"
     check_result $? "Exim restart failed"

+ 2 - 8
bin/module/spamassassin/exim-integration/enable.inc

@@ -16,14 +16,8 @@ hestia_module_spamassassin_exim-integration_enable() {
     fi
     fi
 
 
     echo "Enabling SpamAssassin-Exim integration..."
     echo "Enabling SpamAssassin-Exim integration..."
-
-    if [ "$OS_BASE" = 'debian' ]; then
-        /usr/bin/sed -i "/^#SPAMASSASSIN\s*=\s*/ s/#*//" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-        /usr/bin/sed -i "/^#SPAM_SCORE\s*=\s*/ s/#*//" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf.template
-    else
-        /usr/bin/sed -i "/^#SPAMASSASSIN\s*=\s*/ s/#*//" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-        /usr/bin/sed -i "/^#SPAM_SCORE\s*=\s*/ s/#*//" $OSAL_PATH_EXIM_CONF/${OSAL_PKG_EXIM}.conf
-    fi
+    /usr/bin/sed -i "/^#SPAMASSASSIN\s*=\s*/ s/#*//" "$OSAL_PATH_EXIM_CONF"
+    /usr/bin/sed -i "/^#SPAM_SCORE\s*=\s*/ s/#*//" "$OSAL_PATH_EXIM_CONF"
 
 
     osal_service_restart $OSAL_SERVICE_EXIM
     osal_service_restart $OSAL_SERVICE_EXIM
     check_result $? "Exim restart failed"
     check_result $? "Exim restart failed"

+ 3 - 3
bin/v-add-mail-domain

@@ -111,10 +111,10 @@ if [[ "$MAIL_SYSTEM" =~ exim ]]; then
     if [ ! -z "$local_ip" ]; then
     if [ ! -z "$local_ip" ]; then
         IP_RDNS=$(is_ip_rdns_valid "$local_ip")
         IP_RDNS=$(is_ip_rdns_valid "$local_ip")
         if [ ! -z "$IP_RDNS" ]; then
         if [ ! -z "$IP_RDNS" ]; then
-            if [ $(grep -s "^${domain}:" $OSAL_PATH_EXIM_CONF/mailhelo.conf) ]; then
-                sed -i "/^${domain}:/c\\${domain}:${IP_RDNS}" $OSAL_PATH_EXIM_CONF/mailhelo.conf
+            if [ $(grep -s "^${domain}:" $OSAL_DIR_EXIM_CONF/mailhelo.conf) ]; then
+                sed -i "/^${domain}:/c\\${domain}:${IP_RDNS}" $OSAL_DIR_EXIM_CONF/mailhelo.conf
             else
             else
-                echo ${domain}:${IP_RDNS} >> $OSAL_PATH_EXIM_CONF/mailhelo.conf
+                echo ${domain}:${IP_RDNS} >> $OSAL_DIR_EXIM_CONF/mailhelo.conf
             fi
             fi
         fi        
         fi        
     fi
     fi

+ 1 - 1
bin/v-delete-mail-domain

@@ -87,7 +87,7 @@ rm -f $USER_DATA/mail/$domain.pub
 rm -f $USER_DATA/mail/*@$domain.msg
 rm -f $USER_DATA/mail/*@$domain.msg
 
 
 # Unsetting HELO for mail domain
 # Unsetting HELO for mail domain
-sed -i "/^${domain}:/d" $OSAL_PATH_EXIM_CONF/mailhelo.conf
+sed -i "/^${domain}:/d" $OSAL_DIR_EXIM_CONF/mailhelo.conf
 
 
 # Decreasing domain value
 # Decreasing domain value
 decrease_user_value "$user" '$U_MAIL_DOMAINS'
 decrease_user_value "$user" '$U_MAIL_DOMAINS'

+ 3 - 1
func/osal_debian_based.sh

@@ -45,7 +45,9 @@ OSAL_PATH_DOVECOT_CONF=/etc/dovecot
 OSAL_SERVICE_EXIM=exim4
 OSAL_SERVICE_EXIM=exim4
 OSAL_USER_EXIM=Debian-exim
 OSAL_USER_EXIM=Debian-exim
 OSAL_PKG_EXIM='exim4 exim4-daemon-heavy'
 OSAL_PKG_EXIM='exim4 exim4-daemon-heavy'
-OSAL_PATH_EXIM_CONF=/etc/exim4
+OSAL_FILENAME_EXIM_CONF="exim4.conf.template"
+OSAL_DIR_EXIM_CONF=/etc/exim4
+OSAL_PATH_EXIM_CONF="${OSAL_DIR_EXIM_CONF}/${OSAL_FILENAME_EXIM_CONF}"
 
 
 # Nginx
 # Nginx
 OSAL_SERVICE_NGINX=nginx
 OSAL_SERVICE_NGINX=nginx

+ 3 - 1
func/osal_rhel_based.sh

@@ -44,7 +44,9 @@ OSAL_PATH_DOVECOT_CONF=/etc/dovecot
 OSAL_SERVICE_EXIM=exim
 OSAL_SERVICE_EXIM=exim
 OSAL_USER_EXIM=exim
 OSAL_USER_EXIM=exim
 OSAL_PKG_EXIM=exim
 OSAL_PKG_EXIM=exim
-OSAL_PATH_EXIM_CONF=/etc/exim
+OSAL_FILENAME_EXIM_CONF="${OSAL_PKG_EXIM}.conf"
+OSAL_DIR_EXIM_CONF=/etc/exim
+OSAL_PATH_EXIM_CONF="${OSAL_DIR_EXIM_CONF}/${OSAL_FILENAME_EXIM_CONF}"
 
 
 # Nginx
 # Nginx
 OSAL_SERVICE_NGINX=nginx
 OSAL_SERVICE_NGINX=nginx

+ 4 - 4
func/rebuild.sh

@@ -529,13 +529,13 @@ rebuild_mail_domain_conf() {
         if [ ! -z "$local_ip" ]; then
         if [ ! -z "$local_ip" ]; then
             IP_RDNS=$(is_ip_rdns_valid "$local_ip")
             IP_RDNS=$(is_ip_rdns_valid "$local_ip")
             if [ ! -z "$IP_RDNS" ]; then
             if [ ! -z "$IP_RDNS" ]; then
-                if [ $(grep -s "^${domain}:" $OSAL_PATH_EXIM_CONF/mailhelo.conf) ]; then
-                    sed -i "/^${domain}:/c\\${domain}:${IP_RDNS}" $OSAL_PATH_EXIM_CONF/mailhelo.conf
+                if [ $(grep -s "^${domain}:" $OSAL_DIR_EXIM_CONF/mailhelo.conf) ]; then
+                    sed -i "/^${domain}:/c\\${domain}:${IP_RDNS}" $OSAL_DIR_EXIM_CONF/mailhelo.conf
                 else
                 else
-                    echo ${domain}:${IP_RDNS} >> $OSAL_PATH_EXIM_CONF/mailhelo.conf
+                    echo ${domain}:${IP_RDNS} >> $OSAL_DIR_EXIM_CONF/mailhelo.conf
                 fi
                 fi
             else
             else
-                sed -i "/^${domain}:/d" $OSAL_PATH_EXIM_CONF/mailhelo.conf
+                sed -i "/^${domain}:/d" $OSAL_DIR_EXIM_CONF/mailhelo.conf
             fi
             fi
         fi
         fi