From c658fd1e6cce2320f5dd649054cfd6736739f9d3 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 15:19:43 +0530 Subject: [PATCH] Fixed Amvis ViMbAdmin password issue, Fixed RAM based installation of Mail scanner --- bin/easyengine | 19 +++++++++++++------ .../install/mail/ee_mod_setup_mailscaner.sh | 9 +++++++++ src/vendor/ee_ven_setup_vimbadmin.sh | 6 +----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index fc023082..d5a5458f 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -45,6 +45,8 @@ elif [ "$EE_FIRST" = "info" ];then elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # EasyEngine install if [ "$EE_SECOND" = "install" ]; then + # Detect RAM of system and initialize the variables. + ee_lib_ram if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ] || [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ]; then if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ]; then # Setup NGINX/PHP repository @@ -154,8 +156,6 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Install Dovecot ee_mod_install_dovecot - # Install mail scanner packages - ee_mod_install_mailscaner # Install ViMbAdmin ee_ven_install_vimbadmin @@ -169,9 +169,6 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Configure Dovecot ee_mod_setup_dovecot - # Setup Amavis - ee_mod_setup_mailscaner - # Setup ViMbAdmin ee_ven_setup_vimbadmin @@ -180,7 +177,17 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Setup Sieve Rules ee_mod_setup_sieve - + + if [ "$EE_SETUP_MAILSCANNER" != "no" ]; then + # Install mail scanner packages + ee_mod_install_mailscaner + + # Setup Amavis + ee_mod_setup_mailscaner + else + ee_lib_echo "Found RAM less than 512MB, not installing Mail Scanner packages" + + fi ee_lib_service nginx postfix dovecot amavis restart ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Initialize Git" diff --git a/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh index 59c17249..46a391df 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh @@ -25,6 +25,15 @@ function ee_mod_setup_mailscaner() || ee_lib_error "Unable to setup Amavis, exit status = " $? cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf + # Grep ViMbAdmin host and Password from Postfix Configuration + ee_vimbadmin_host=$(grep password /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }') + ee_vimbadmin_password=$(grep hosts /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }') + + # Changing hosts and password of ViMbAdmin database in Amavis configuration + sed -i "s/127.0.0.1/$ee_vimbadmin_host/" /etc/amavis/conf.d/50-user && + sed -i "s/password/$ee_vimbadmin_password/" /etc/amavis/conf.d/50-user \ + || ee_lib_error "Unable to setup ViMbAdmin database details in Amavis configuration, exit status = " $? + # Configure ClamAv and Amavis to each other files adduser clamav amavis &>> $EE_COMMAND_LOG adduser amavis clamav &>> $EE_COMMAND_LOG diff --git a/src/vendor/ee_ven_setup_vimbadmin.sh b/src/vendor/ee_ven_setup_vimbadmin.sh index 993b94fc..4ad1509d 100644 --- a/src/vendor/ee_ven_setup_vimbadmin.sh +++ b/src/vendor/ee_ven_setup_vimbadmin.sh @@ -36,6 +36,7 @@ function ee_ven_setup_vimbadmin() || ee_lib_error "Unable to setup ViMbAdmin configuration file, exit status = " $? # Changing hosts and password of ViMbAdmin database in postfix configuration + # Note: As Amavis is optional, Amavis ViMbAdmin settings are present is ee_mod_setup_mailscaner function sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_alias_maps.cf && sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_alias_maps.cf \ || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_alias_maps.cf file, exit status = " $? @@ -52,11 +53,6 @@ function ee_ven_setup_vimbadmin() sed -i "s/hosts=localhost/hosts=$ee_vimbadmin_host/" /etc/dovecot/dovecot-sql.conf.ext \ || ee_lib_error "Unable to setup ViMbAdmin database details in dovecot-sql.conf.ext file, exit status = " $? - # Changing hosts and password of ViMbAdmin database in Amavis configuration - sed -i "s/127.0.0.1/$ee_vimbadmin_host/" /etc/amavis/conf.d/50-user && - sed -i "s/password/$ee_random/" /etc/amavis/conf.d/50-user \ - || ee_lib_error "Unable to setup ViMbAdmin database details in 50-user file, exit status = " $? - # Copying HTACCESS cp -av /var/www/22222/htdocs/vimbadmin/public/.htaccess.dist /var/www/22222/htdocs/vimbadmin/public/.htaccess &>> $EE_COMMAND_LOG