1

Topic: issue with installing to remote db

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.6 MARIADB edition.
- Linux/BSD distribution name and version: Linux mail 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mysql(mariadb)
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? no
- Related log if you're reporting an issue:
====

i'm trying to install like in this sample http://www.iredmail.org/docs/install.ir … erver.html
but getting this error:

********************************************************************
* Start iRedMail Configurations
********************************************************************
[ INFO ] Create self-signed SSL certification files (2048 bits).
[ INFO ] Generate Diffie Hellman Group with openssl, please wait.
[ INFO ] Create required system account: vmail, iredadmin, iredapd.
[ INFO ] Configure Nginx web server and uWSGI.
[ INFO ] Configure PHP.
[ INFO ] Configure MariaDB database server.
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
[ INFO ] Setup daily cron job to backup SQL databases with /var/vmail/backup/backup_mysql.sh
[ INFO ] Configure Postfix (MTA).
[ INFO ] Configure Dovecot (POP3/IMAP/Managesieve/LMTP/LDA).
[ INFO ] Configure ClamAV (anti-virus toolkit).
[ INFO ] Configure Amavisd-new (interface between MTA and content checkers).
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
[ INFO ] Configure SpamAssassin (content-based spam filter).
[ INFO ] Configure iRedAPD (postfix policy daemon).
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
[ INFO ] Configure iRedAdmin (official web-based admin panel).
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
[ INFO ] Configure Fail2ban (authentication failure monitor).
[ INFO ] Configure Roundcube webmail.
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
ERROR 1045 (28000): Access denied for user 'admin_iredmail'@'db_ip' (using password: YES)
[ INFO ] Configure Awstats (logfile analyzer for mail and web server).

Also, i can connect to database from cli, so i don't know what could happened sad

----

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

2

Re: issue with installing to remote db

Did you create sql user 'admin_iredmail' like this?

GRANT ALL PRIVILEGES ON *.* TO 'admin_iredmail'@'192.168.1.200' IDENTIFIED BY 'admin_password' WITH GRANT OPTION;

The IP 192.168.1.200 should be the real ip of your iRedMail server, not the IP of mysql database server.

3

Re: issue with installing to remote db

ZhangHuangbin wrote:

Did you create sql user 'admin_iredmail' like this?

GRANT ALL PRIVILEGES ON *.* TO 'admin_iredmail'@'192.168.1.200' IDENTIFIED BY 'admin_password' WITH GRANT OPTION;

The IP 192.168.1.200 should be the real ip of your iRedMail server, not the IP of mysql database server.

yes, i have created this user and can connect with it from cli.

4

Re: issue with installing to remote db

*) Please show us output of sql command you used to connect to remote db.
*) Any error in file iRedMail-0.9.6/runtime/*?

5

Re: issue with installing to remote db

ZhangHuangbin wrote:

*) Please show us output of sql command you used to connect to remote db.
*) Any error in file iRedMail-0.9.6/runtime/*?

root@mail:~/iRedMail-0.9.6# mysql -uadmin_iredmail -padmin_password -hremote_ip
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 214
Server version: 10.1.22-MariaDB-1~xenial mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

where remote_ip same as MYSQL_SERVER_ADDRESS

install.log: https://gist.github.com/aLkRicha/8c7ea3 … bbb662dcb1
install.status: https://gist.github.com/aLkRicha/e8169e … ef947f34a0

6

Re: issue with installing to remote db

Please try to create new sql database and sql tables manually after you connected from cli, seems this user doesn't have required privileges.

7

Re: issue with installing to remote db

ZhangHuangbin wrote:

Please try to create new sql database and sql tables manually after you connected from cli, seems this user doesn't have required privileges.

i did all like in your sample, so privileges are setted correctly. How cal i check privileges for you?

8

Re: issue with installing to remote db

MariaDB [(none)]> SHOW GRANTS FOR 'admin_iredmail'@'public_ip';
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin_iredmail@public_ip                                                                                                             |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admin_iredmail'@'public_ip' IDENTIFIED BY PASSWORD '*C42C45AEA7AE39A23B6EB2F0954E976DD4576B65' WITH GRANT OPTION |
+---------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> SHOW GRANTS FOR 'admin_iredmail'@'private_ip';
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for admin_iredmail@private_ip                                                                                                              |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'admin_iredmail'@'private_ip' IDENTIFIED BY PASSWORD '*C42C45AEA7AE39A23B6EB2F0954E976DD4576B65' WITH GRANT OPTION |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

9

Re: issue with installing to remote db

After you connected from cli, try to create new sql db manually, for example:

 create database test2;

Also try to create new sql table in this new sql db.

10

Re: issue with installing to remote db

MariaDB [(none)]>  create database test2;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> use test2;
Database changed
MariaDB [test2]> CREATE TABLE t (c CHAR(20) CHARACTER SET utf8 COLLATE utf8_bin);
Query OK, 0 rows affected (0.02 sec)

MariaDB [test2]> show tables;
+-----------------+
| Tables_in_test2 |
+-----------------+
| t               |
+-----------------+
1 row in set (0.00 sec)

looks like it works

11

Re: issue with installing to remote db

Also, create new user like this:

GRANT SELECT,INSERT,UPDATE,DELETE ON test2.* TO 'test_user'@'192.168.0.200' IDENTIFIED BY 'password';

12

Re: issue with installing to remote db

MariaDB [(none)]> GRANT SELECT,INSERT,UPDATE,DELETE ON test2.* TO 'test_user'@'192.168.0.200' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

also works =\

13

Re: issue with installing to remote db

After iRedMail installation, please connect to remote db and check whether all sql databases have been created:

 show databases 

14 (edited by krich.al.vl 2017-03-18 04:30:25)

Re: issue with installing to remote db

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test2              |
+--------------------+
6 rows in set (0.00 sec)

no, they have not been created.

15

Re: issue with installing to remote db

What's the original command you used to install iRedMail? Like this:

USE_EXISTING_MYSQL='YES' \ MYSQL_SERVER_ADDRESS='192.168.1.100' \ MYSQL_SERVER_PORT='3306' \ MYSQL_ROOT_USER='admin_iredmail' \ MYSQL_ROOT_PASSWD='admin_password' \ MYSQL_GRANT_HOST='192.168.1.200' \ bash iRedMail.sh

16

Re: issue with installing to remote db

USE_EXISTING_MYSQL='YES' MYSQL_SERVER_ADDRESS='db_ip' MYSQL_SERVER_PORT='3306' MYSQL_ROOT_USER='admin_iredmail' MYSQL_ROOT_PASSWD='admin_password' MYSQL_GRANT_HOST='iredmail_ip' bash iRedMail.sh

17

Re: issue with installing to remote db

Everything looks just fine, seems it's a bug of iRedMail-0.9.6, I will test it later.

18

Re: issue with installing to remote db

ZhangHuangbin wrote:

Everything looks just fine, seems it's a bug of iRedMail-0.9.6, I will test it later.

cool big_smile and what i need to do? maybe there is fast way for hotfix installer and install it

19

Re: issue with installing to remote db

Did a quick test, it works fine for me.

Question: did you have iRedMail-0.9.6/config file BEFORE the last time you run command below?

USE_EXISTING_MYSQL='YES' MYSQL_SERVER_ADDRESS='db_ip' MYSQL_SERVER_PORT='3306' MYSQL_ROOT_USER='admin_iredmail' MYSQL_ROOT_PASSWD='admin_password' MYSQL_GRANT_HOST='iredmail_ip' bash iRedMail.sh

The 'config' file contains mysql root username and password. Please try to restore server OS and reinstall iRedMail, when it asks you to use existing config file, choose 'NO', then iRedMail will run installation wizard to generate a new 'config' file.

20

Re: issue with installing to remote db

ZhangHuangbin wrote:

Did a quick test, it works fine for me.

Question: did you have iRedMail-0.9.6/config file BEFORE the last time you run command below?

USE_EXISTING_MYSQL='YES' MYSQL_SERVER_ADDRESS='db_ip' MYSQL_SERVER_PORT='3306' MYSQL_ROOT_USER='admin_iredmail' MYSQL_ROOT_PASSWD='admin_password' MYSQL_GRANT_HOST='iredmail_ip' bash iRedMail.sh

The 'config' file contains mysql root username and password. Please try to restore server OS and reinstall iRedMail, when it asks you to use existing config file, choose 'NO', then iRedMail will run installation wizard to generate a new 'config' file.

before running install command i have this dir structure:

root@mail:~/iRedMail-0.9.6# ls -la
total 116
drwxr-xr-x  8 root root  4096 Jan 24 15:57 .
drwx------  6 root root  4096 Mar 18 05:23 ..
-rw-r--r--  1 root root 66531 Jan 24 15:57 ChangeLog
drwxr-xr-x  2 root root  4096 Mar 16 07:22 conf
drwxr-xr-x  2 root root  4096 Jan 24 15:57 dialog
-rw-r--r--  1 root root   318 Jan 24 15:57 Documentations
drwxr-xr-x  2 root root  4096 Mar 18 01:08 functions
-rw-r--r--  1 root root  5263 Jan 24 15:57 iRedMail.sh
drwxr-xr-x  2 root root  4096 Mar 16 07:21 pkgs
-rw-r--r--  1 root root   785 Jan 24 15:57 README.md
drwxr-xr-x 21 root root  4096 Jan 24 15:57 samples
drwxr-xr-x  2 root root  4096 Mar 16 07:38 tools

and it did not ask me about using config file.

21

Re: issue with installing to remote db

Please show me full content of "config" file, you can replace passwords by "..." .

22

Re: issue with installing to remote db

ZhangHuangbin wrote:

Please show me full content of "config" file, you can replace passwords by "..." .

run installation and then show config file?

23

Re: issue with installing to remote db

root@mail:~/iRedMail-0.9.6# cat config

export STORAGE_BASE_DIR='/var/vmail'
export WEB_SERVER='NGINX'
export BACKEND_ORIG='MARIADB'
export BACKEND='MYSQL'
export VMAIL_DB_BIND_PASSWD='gh4PxdZ6UIwrxIoJgUcj40Xs6VxrO3'
export VMAIL_DB_ADMIN_PASSWD='K7vGtB79p5IM6Rkm9JzpmQWh3PdC33'
export MYSQL_ROOT_PASSWD='dasdasdasd'
export FIRST_DOMAIN='example.com'
export DOMAIN_ADMIN_PASSWD_PLAIN='dasdasdasd'
export USE_IREDADMIN='YES'
export USE_ROUNDCUBE='YES'
export USE_AWSTATS='YES'
export USE_FAIL2BAN='YES'
export AMAVISD_DB_PASSWD='rktOUHav8FHzjfU6Fw9z6stbrRqxRO'
export IREDADMIN_DB_PASSWD='sZGNljU1IIMeZcWFe21WSl6D3jRZVe'
export RCM_DB_PASSWD='bp9Ml22uIJ3YzSPKg4Fdj2eTfGIgVq'
export SOGO_DB_PASSWD='EKxEOVlJNezIMLTFaKHn89ZCMtvUfI'
export SOGO_SIEVE_MASTER_PASSWD='Bsrpr78pnnqqzlrAXkFZE2YfEtTDyV'
export IREDAPD_DB_PASSWD='i7AamxtgNbdI8RthasFhypjO9xQxGp'
#EOF

24

Re: issue with installing to remote db

Dear krich, the posted config file contains all your passwords, for your own safety I would recommend you to edit this post and change everything with PASSWD= to xxx to ensure full safety of your data in case of a breach.

25

Re: issue with installing to remote db

Wraptor wrote:

Dear krich, the posted config file contains all your passwords, for your own safety I would recommend you to edit this post and change everything with PASSWD= to xxx to ensure full safety of your data in case of a breach.

thanks) but there are just sample passwords)