1 (edited by duckprojects 2018-06-28 06:27:28)

Topic: No mysql root password after install

======== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.8
- Linux/BSD distribution name and version: Debian 9 & Ubuntu 18.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello,

After successfully installing my primary iRedMail MX on an Ubuntu Server 16.04, I tried to install iRedMail on a new server to get a backup MX.

I just need a backup MX which can :
- Perform Spam/Virus scan
- Perform a domain sorting (only allow mails for domains configured on my primary MX, reject others)
- Store and forward "clean" mails to primary MX  for all users of the domain (users sorting will be performed by primary MX)

So I installed my backup MX on a fresh Debian 9 server with the following options when running "iRedMail.sh" :
- Only install Nginx, iRedAdmin and Fail2Ban
- Choose MariaDB backend

After installation, in order to perform operations described in https://docs.iredmail.org/backupmx.html ,I tried to connect to the DB with the following command : "mysql -u root" and was not asked for the password. A "show databases" command shows the whole content of the DB.

Because I didn't get this issue when performing the full installation on my primary iRedMail (Ubuntu Server 16.04), I chose to install Ubuntu Server 18.04 on my Backup MX.

After re installing iRedMail with the same options (except I chose MySQL for backend) on the fresh Ubuntu 18.04 Server, the same issue appeared.

Is the command line to protect MySQL root access by password in a script I'm not executing in this install case ? Are there other such security leaks I should investigate for in this install case ?

----

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

2

Re: No mysql root password after install

MySQL reads ~/.my.cnf to get server address, username, password. and iRedMail generates /root/.my.cnf.

3 (edited by duckprojects 2018-07-02 17:05:28)

Re: No mysql root password after install

Hello Zhang,

Again, thanks for your fast support !

Does a simple "ln -s ~/.my.cnf /root/.my.cnf" will do the trick ?

For my knowledge : In which script/when is this step done when performing a full install of iRedMail ?

4

Re: No mysql root password after install

duckprojects wrote:

Does a simple "ln -s ~/.my.cnf /root/.my.cnf" will do the trick ?

Source file and target file are same?

duckprojects wrote:

For my knowledge : In which script/when is this step done when performing a full install of iRedMail ?

I don't understand this sentence. sad

5 (edited by duckprojects 2018-07-04 04:06:55)

Re: No mysql root password after install

Hello Zhang,

[EDIT]
I deleted everything i posted before because after some tests on the machine, I think i got it. Please correct me if the following is wrong :

- iRedMail generates ".my.cnf" file in "/root" folder
- MySQL try to retrieve "~/.my.cnf" content in order to connect directly without user/password
-  As i was logged as root, "/root/.my.cnf" = "~/.my.cnf", so it connected without asking for a password
- If you try to connect mysql while logged in with another system user, it won't connect to mysql without explicitly passing these informations through the mysql connection command line
[/EDIT]

Have I understand this time ? :-)

Duck

6

Re: No mysql root password after install

duckprojects wrote:

Have I understand this time ? :-)

correct. smile