1

Topic: openldap backup script genereates access denied when updating log db

==== Required information ====
- iRedMail version (check /etc/iredmail-release):  0.9.7
- Linux/BSD distribution name and version: Centos 7.  3.10.0-514.26.2.el7.x86_6
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  LDAP
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

Starting backup at 2017-07-27-03-00-01
* Backup directory: /var/vmail/backup/ldap/2017/07.
* Dumping LDAP data into file: /var/vmail/backup/ldap/2017/07/2017-07-27-03-00-01.ldif...
* Compressing LDIF file with command: 'bzip2 -9' ...
* [DONE]
* Removing plain LDIF file: /var/vmail/backup/ldap/2017/07/2017-07-27-03-00-01.ldif...    [DONE]
ERROR 1045 (28000): Access denied for user 'iredadmin'@'localhost' (using password: YES)
====

LDAP backups performed, but not logged to mariadb log  database
The cronjob script /var/vmail/backup/backup_openldap.sh
line 170
       export CMD_MYSQL_ROOT="${CMD_MYSQL} -u'${MYSQL_USER}' -p'${MYSQL_PASSWD}'"

When called on line 199
   ${CMD_MYSQL_ROOT} iredadmin -e "${sql_log_msg}" >>${LOGFILE} 2>&1

creating a cli command that adds character "\" in front of and after the username and password 
    -u\iredmail\ -p\SecretPassword\
Thats why the access denied message is thrown.

If I modify line 170, and remove character '  arround ${MYSQL_USER}'  and '${MYSQL_PASSWD}'  , it works OK


#      export CMD_MYSQL_ROOT="${CMD_MYSQL} -u'${MYSQL_USER}' -p'${MYSQL_PASSWD}'"
        export CMD_MYSQL_ROOT="${CMD_MYSQL} -u${MYSQL_USER} -p${MYSQL_PASSWD}" 

Regards,
swejun

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: openldap backup script genereates access denied when updating log db

swejun wrote:

If I modify line 170, and remove character '  arround ${MYSQL_USER}'  and '${MYSQL_PASSWD}'  , it works OK

You're right. Fixed:
https://bitbucket.org/zhb/iredmail/comm … 1c5e2f43d7