CentOS 5.5 : Postfix, Dovecot & MySQL

Posted by GruffTech on Server Fault See other posts from Server Fault or by GruffTech
Published on 2010-05-21T18:59:12Z Indexed on 2010/05/21 19:02 UTC
Read the original article Hit count: 1104

Filed under:
|
|
|
|

I'm hoping someone has seen this issue before because I'm at quite a loss. We're building a new outbound smtp server for our clients that features anti-spam scanning and virus scanning for outbound emails, something we had not previously done.

So with CentOS 5.5 x64, Installed and patched completely. Postfix & Dovecot both installed via base repo.

[grufftech@outgoing postfix]# rpm -qa | grep postfix
postfix-2.3.3-2.1.el5_2
[grufftech@outgoing postfix]# rpm -qa | grep dovecot
dovecot-1.0.7-7.el5

[grufftech@outgoing ~]# dovecot --build-options
Build options: ioloop=poll notify=inotify ipv6 openssl
SQL drivers: mysql postgresql
Passdb: checkpassword ldap pam passwd passwd-file shadow sql
Userdb: checkpassword ldap passwd prefetch passwd-file sql static

/etc/dovecot.conf

auth default {
  mechanisms = plain login digest-md5 cram-md5
  passdb sql {
    args = /etc/dovecot-mysql.conf
  }
  userdb sql {
    args = /etc/dovecot-mysql.conf
  }
  userdb prefetch {
  }
  user = nobody
  socket listen {
    master {
      path = /var/run/dovecot/auth-master
      mode = 0660
      user = postfix
      group = postfix
    }
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = postfix
    }
  }
}

All the server is doing is auth for postfix, so no reason to have imap / pop / dict.

/etc/dovecot-mysql.conf

driver = mysql
connect = host=10.0.32.159 dbname=mail user=****** password=********
default_pass_scheme = plain
user_query = select 1
password_query = select password from users where username = '%n' and domain = '%d'

So drop in my configuration, (which is working on another server identical to this one.)

[grufftech@outgoing ~]# /etc/init.d/dovecot start
Starting Dovecot Imap:                                     [  OK  ]

Sweet. Booted up nicely, thats good.... (incoming problem in 3....2....1....)

May 21 08:09:01 outgoing dovecot: Dovecot v1.0.7 starting up
May 21 08:09:02 outgoing dovecot: auth-worker(default): mysql: Connect failed to 10.0.32.159 (mail): Can't connect to MySQL server on '10.0.32.159' (13) - waiting for 1 seconds before retry

well what the crap. went and checked permissions on my MySQL database, and its fine.

[grufftech@outgoing ~]# mysql vpopmail -h 10.0.32.159 -u ****** -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 127828558
Server version: 4.1.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>\q

So! My server can talk to my database server. but dovecot, for whatever reason, isn't able to. I've fiddled with it for the last six hours, grabbed slightly-older copies of the RPM (ones that matched our production server exactly) to test those, copied configs, searched google, searched server fault, chatted in IRC, banged my head against the table, I've done it all.

Surely I'm doing something wrong or forgetting something, can anyone tell me what the elephant in the room is? This stuff is supposed to work.

© Server Fault or respective owner

Related posts about postfix

Related posts about dovecot