[Dovecot] Authentication problems with mysql 5

Gianfranco Bartolini gianfranco.bartolini at tiscali.it
Thu Jun 15 02:59:28 EEST 2006


Hello, this is my first post here, so hi to all!

I've just configured a new Suse Linux 10.1 distribution that comes with:
- postfix 2.2.9 + mysql tables
- dovecot 1.0.beta3
- mysql 5.0.18
- kernel 2.6.16.13-4-bigsmp i386 on a Intel Xeon 2.0Ghz with 3Gb RAM

I've also added postfixadmin 2.1.0 to build an IMAP server with virtual
users/virtual hosts management, and ran the script DATABASE_MYSQL.TXT to
build correctly database/tables and user/permissions.

The problem is that dovecot fail to access to mysql tables with the
following error:

===================
dovecot: Jun 12 18:40:28 Info: Dovecot v1.0.beta3 starting up
dovecot: Jun 12 18:40:29 Error: auth-worker(default): mysql: Connect failed
to 127.0.0.1 (postfix): Access denied for user 'postfix'@'localhost' (using
password: YES) - waiting for 1 seconds before retry
===================

I've tried to connect to mysql using the socket instead of the local ip
address, but i've got the same error:

===================
dovecot: Jun 12 18:55:19 Info: Dovecot v1.0.beta3 starting up
dovecot: Jun 12 18:55:20 Error: auth-worker(default): mysql: Connect failed
to (null) (postfix): Access denied for user 'postfix'@'localhost' (using
password: YES) - waiting for 1 seconds before retry
===================

In mysql the user "postfix" is correctly created with access granted from
either localhost and 127.0.0.1

If i do the same from the command line it works perfectly:

===================
server01:/ # mysql -h localhost -u postfix -p
Enter password: secret
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 136 to server version: 5.0.18

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

mysql>
===================

Here is my dovecot.conf:

===================
default_mail_env = maildir:/home/mbox/%d/%n
protocols = imap pop3
auth default {
        mechanisms = plain
        userdb sql {
                args = /etc/dovecot/dovecot-sql.conf
        }
        passdb sql {
                args = /etc/dovecot/dovecot-sql.conf
        }
}
first_valid_uid = 51
ssl_disable = yes
listen = *
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot.log
===================

And my dovecot-sql.conf:

===================
driver = mysql
connect = host=/var/lib/mysql/mysql.sock dbname=postfix user=postfix
password=secret
default_pass_scheme = PLAIN
password_query = SELECT password FROM mailbox WHERE username = '%u' AND
active =  '1'
user_query = SELECT maildir AS mail, 51 AS uid, 51 AS gid FROM mailbox WHERE
username = '%u' AND active = '1'
===================

I'v tried also all the password mechanisms (PLAIN, PLAIN-MD5, MD5, CRYPT)
with no success.

My google searches ended with no results. Btw, the same configuration on a
Suse 9.3 professional works perfectly :(

Please anyone can help me?

Thanks in advance for all the kindly support

Saluti
G.Bartolini
Linux User #333064 



More information about the dovecot mailing list