From b6231d187cba9c0f91d60f603f5d0c6f68538113 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 26 Aug 2014 19:35:34 +0530 Subject: [PATCH] Fixed Postfix not connecting to local MySQL --- src/vendor/ee_ven_setup_vimbadmin.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/vendor/ee_ven_setup_vimbadmin.sh b/src/vendor/ee_ven_setup_vimbadmin.sh index e432897c..c60161a5 100644 --- a/src/vendor/ee_ven_setup_vimbadmin.sh +++ b/src/vendor/ee_ven_setup_vimbadmin.sh @@ -2,6 +2,12 @@ function ee_ven_setup_vimbadmin() { + if [ $EE_MYSQL_HOST = "localhost" ];then + ee_vimbadmin_host="127.0.0.1" + else + ee_vimbadmin_host=$EE_MYSQL_HOST + fi + ee_lib_echo "configuring ViMbAdmin, please wait..." # Random characters @@ -25,29 +31,29 @@ function ee_ven_setup_vimbadmin() sed -i "s'/srv/vmail/%d/%u'/var/vmail/'" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && sed -i "s/pdo_mysql/mysqli/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && sed -i "s/'xxx'/'$ee_random'/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && - sed -i "s/resources.doctrine2.connection.options.host = 'localhost'/resources.doctrine2.connection.options.host = '$EE_MYSQL_HOST'/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s/resources.doctrine2.connection.options.host = 'localhost'/resources.doctrine2.connection.options.host = '$ee_vimbadmin_host'/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && sed -i "s/defaults.mailbox.password_scheme = \"md5.salted\"/defaults.mailbox.password_scheme = \"md5\"/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini \ || ee_lib_error "Unable to setup ViMbAdmin configuration file, exit status = " $? # Changing hosts and password of ViMbAdmin database in postfix configuration 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_MYSQL_HOST/" /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 = " $? sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_domains_maps.cf && - sed -i "s/hosts = 127.0.0.1/hosts = $EE_MYSQL_HOST/" /etc/postfix/mysql/virtual_domains_maps.cf \ + sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_domains_maps.cf \ || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_domains_maps.cf file, exit status = " $? sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_mailbox_maps.cf && - sed -i "s/hosts = 127.0.0.1/hosts = $EE_MYSQL_HOST/" /etc/postfix/mysql/virtual_mailbox_maps.cf \ + sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_mailbox_maps.cf \ || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_mailbox_maps.cf file, exit status = " $? sed -i "s/password=password/password=$ee_random/" /etc/dovecot/dovecot-sql.conf.ext && - sed -i "s/hosts=localhost/hosts=$EE_MYSQL_HOST/" /etc/dovecot/dovecot-sql.conf.ext \ + 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_MYSQL_HOST/" /etc/amavis/conf.d/50-user && + 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 = " $?