[CentOS] Solved - Re: SELinux policy to allow Dovecot to connect to Mysql

Fri Apr 7 15:14:07 UTC 2017
Robert Moskowitz <rgm at htt-consult.com>

I reread my dovecot sql.conf.ext files and realized they were actually 
connecting to localhost.  So I did some googling, and found how to 
connect to the socket:

connect = host=/var/lib/mysql/mysql.sock dbname=postfix user=postfix 
password=Postfix_Database_Password

And all fixed.  No more failures.  Plus probably securer.

On 04/07/2017 10:37 AM, Robert Moskowitz wrote:
> I have been getting the following on my new mailserver:
>
> Apr  7 10:17:27 z9m9z dovecot: dict: Error: mysql(localhost): Connect 
> failed to database (postfix): Can't connect to local MySQL server 
> through socket '/var/lib/mysql/mysql.sock' (13) - waiting for 25 
> seconds before retry
>
> They go away when I setenforce 0.
>
> So I googled dovecot mysql selinux and the only worthwhile hit was:
>
> http://zszsit.blogspot.com/2012/12/dovecot-mysql-selinux-issue-on-centos6.html 
>
>
> that provides a /etc/selinux/dovecot2mysql.te
>
> Is there a simpler way like a setsbool option?
>
> With all the howtos on dovecot with mysql, it is interesting that none 
> of them seem to have this problem.  Maybe because they connect to 
> mysql through TCP port 3306 which has ITS set of problems (like 
> MariaDB defaults to not listening on TCP).
>
> thanks!
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>