diff --git a/convert_dovecot_pfa_password.sh b/convert_dovecot_pfa_password.sh index 11914f4..b815c66 100755 --- a/convert_dovecot_pfa_password.sh +++ b/convert_dovecot_pfa_password.sh @@ -143,6 +143,7 @@ fi log_file_pfa="${LOG_DIR}/convert_password_postfixadmin.log" log_file_pfa_error="${LOG_DIR}/convert_password_postfixadmin.err" +log_file_pfa_csv="${LOG_DIR}/convert_password_pfa.csv" log_file_mailbox="${LOG_DIR}/convert_password_mailbox.log" log_file_mailbox_error="${LOG_DIR}/convert_password_mailbox.err" log_file_mailbox_csv="${LOG_DIR}/convert_password_mailbox.csv" @@ -335,6 +336,8 @@ fi echo -e "\n \033[1mAdjust configuration of Roundcube's password plugin\033[m\n" +echo "" >> $log_file +echo "" >> $log_file echo "# ---" >> $log_file echo "# - Adjust configuration of roundcube password plugin" >> $log_file echo "# -" >> $log_file @@ -379,7 +382,7 @@ if [[ -f "${_config_file}" ]]; then _val="'dovecot'" if ! grep -q -E "^\s*\\\$config\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\s*\\\$config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \ - ${_config_file} > $log_file 2>&1 + ${_config_file} >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi @@ -389,7 +392,7 @@ if [[ -f "${_config_file}" ]]; then _val="'{${DOVECOT_ENC_METHOD_NEW}}'" if ! grep -q -E "^\s*\\\$config\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\s*\\\$config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \ - ${_config_file} > $log_file 2>&1 + ${_config_file} >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi @@ -399,7 +402,7 @@ if [[ -f "${_config_file}" ]]; then _val="'/usr/local/dovecot/bin/doveadm pw'" if ! grep -q -E "^\s*\\\$config\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\s*\\\$config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \ - ${_config_file} > $log_file 2>&1 + ${_config_file} >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi @@ -409,7 +412,7 @@ if [[ -f "${_config_file}" ]]; then _val="'${DOVECOT_ENC_METHOD_NEW}'" if ! grep -q -E "^\s*\\\$config\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\s*\\\$config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \ - ${_config_file} > $log_file 2>&1 + ${_config_file} >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi @@ -419,7 +422,7 @@ if [[ -f "${_config_file}" ]]; then _val="true" if ! grep -q -E "^\s*\\\$config\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\s*\\\$config\['$_key'\].*)#//\!\1\n\\\$config['$_key'] = $_val;#" \ - ${_config_file} > $log_file 2>&1 + ${_config_file} >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi @@ -450,6 +453,7 @@ echo -e "\n \033[1;32mGoing to convert postfixadmin passwords..\033[m\n" log_file="$log_file_pfa" log_file_error="$log_file_pfa_error" +log_file_csv="$log_file_pfa_csv" echo "# ---" >> $log_file echo "# - Convert Password (PostfixAdmin) from Plain to ${DOVECOT_ENC_METHOD_NEW}" >> $log_file echo "# ---" >> $log_file @@ -502,6 +506,8 @@ fi echo -e "\n \033[1mAdjust configuration of Postfixadmin\033[m\n" +echo "" >> $log_file +echo "" >> $log_file echo "# ---" >> $log_file echo "# - Adjust configuration of Postfixadmin" >> $log_file echo "# -" >> $log_file @@ -544,7 +550,7 @@ if [[ -f "$_config_file" ]]; then _val="'dovecot:${DOVECOT_ENC_METHOD_NEW}'" if ! grep -q -E "^\s*\\\$CONF\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\s*\\\$CONF\['$_key'\].*)#//\!\1\n\\\$CONF['$_key'] = $_val;#" \ - ${_config_file} > $log_file 2>&1 + ${_config_file} >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi @@ -555,7 +561,7 @@ if [[ -f "$_config_file" ]]; then if grep -q -E "^\\\$CONF\['$_key'\]\s*=.*" "${_config_file}" 2> /dev/null ; then if ! grep -q -E "^\\\$CONF\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then perl -i -n -p -e "s#(^\\\$CONF\['$_key'\].*)#//\!\1\n\\\$CONF['$_key'] = $_val;#" \ - "$_config_file" > $log_file 2>&1 + "$_config_file" >> $log_file 2>&1 if [[ $? -ne 0 ]] ; then _failed=true fi