[Dovecot] Authentication problems with mysql 5
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
Quoting Gianfranco Bartolini:
to 127.0.0.1 (postfix): Access denied for user 'postfix'@'localhost' (using
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] On Behalf Of Jakob Hirsch Sent: Thursday, June 15, 2006 2:43 AM
to 127.0.0.1 (postfix): Access denied for user 'postfix'@'localhost' (using
Thanks a lot, now it works!
Weird figure, i didn't saw that article...
But now i've got a new problem:
============================== dovecot: Jun 15 17:03:33 Error: imap(ced@example.org): Ambiguous mail location setting, don't know what to do with it: example.org/ced@example.org/ (try prefixing it with mbox: or maildir:) dovecot: Jun 15 17:03:33 Error: imap(ced@example.org): Failed to create storage with data: example.org/ced@example.org/ dovecot: Jun 15 17:03:33 Info: imap-login: Login: user=ced@example.org, method=PLAIN, rip=192.168.70.1, lip=192.168.0.101 dovecot: Jun 15 17:03:33 Error: child 3848 (imap) returned error 89
It seems that dovecot ignore the directive in my dovecot.conf:
default_mail_env = maildir:/home/mbox/%d/%u
I've tried to change it as: default_mail_env = /home/mbox/%d/%u default_mail_env =
but i've got always the same error message.
The directory was correctly created by postfixadmin:
============================== server01:/home/mbox # ls -la total 12 drwxrwx--x 3 postfix postfix 4096 Jun 15 14:36 . drwxr-xr-x 5 root root 4096 Jun 12 15:52 .. drwx------ 3 postfix postfix 4096 Jun 15 14:36 example.org
Any ideas?
Thanks a lot in advance
Saluti G.Bartolini Linux User #333064
Hi,
El Jueves, 15 de Junio de 2006 19:40, Gianfranco Bartolini escribió:
============================== dovecot: Jun 15 17:03:33 Error: imap(ced@example.org): Ambiguous mail location setting, don't know what to do with it: example.org/ced@example.org/ (try prefixing it with mbox: or maildir:) dovecot: Jun 15 17:03:33 Error: imap(ced@example.org): Failed to create storage with data: example.org/ced@example.org/ dovecot: Jun 15 17:03:33 Info: imap-login: Login: user=ced@example.org, method=PLAIN, rip=192.168.70.1, lip=192.168.0.101 dovecot: Jun 15 17:03:33 Error: child 3848 (imap) returned error 89
It seems that dovecot ignore the directive in my dovecot.conf:
default_mail_env = maildir:/home/mbox/%d/%u
I've tried to change it as: default_mail_env = /home/mbox/%d/%u default_mail_env =
You have to prefix the mailbox format; try default_mail_env = mbox:/home/mbox/%d/%u
(if you use mbox)
Aaaaaaaaaaaagur.
-- Trying to make bits uncopyable is like trying to make water not wet. The sooner people accept this, and build business models that take this into account, the sooner people will start making money again. - Bruce Schneier
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] On Behalf Of Joseba Torre Sent: Friday, June 16, 2006 8:56 AM
Hello Joseba,
It seems that dovecot ignore the directive in my dovecot.conf:
default_mail_env = maildir:/home/mbox/%d/%u
I've tried to change it as: default_mail_env = /home/mbox/%d/%u default_mail_env =
You have to prefix the mailbox format; try default_mail_env = mbox:/home/mbox/%d/%u
(if you use mbox)
I've already done it, as you can see above (i use the maildir format) No way :(
Saluti G.Bartolini Linux User #333064
Hi,
Gianfranco Bartolini wrote:
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] On Behalf Of Jakob Hirsch Sent: Thursday, June 15, 2006 2:43 AM
to 127.0.0.1 (postfix): Access denied for user
'postfix'@'localhost' (using
Thanks a lot, now it works!
Weird figure, i didn't saw that article...
But now i've got a new problem:
============================== dovecot: Jun 15 17:03:33 Error: imap(ced@example.org): Ambiguous mail location setting, don't know what to do with it: example.org/ced@example.org/ (try prefixing it with mbox: or maildir:) dovecot: Jun 15 17:03:33 Error: imap(ced@example.org): Failed to create storage with data: example.org/ced@example.org/ dovecot: Jun 15 17:03:33 Info: imap-login: Login: user=ced@example.org, method=PLAIN, rip=192.168.70.1, lip=192.168.0.101 dovecot: Jun 15 17:03:33 Error: child 3848 (imap) returned error 89
It seems that dovecot ignore the directive in my dovecot.conf:
default_mail_env = maildir:/home/mbox/%d/%u
I've tried to change it as: default_mail_env = /home/mbox/%d/%u default_mail_env =
but i've got always the same error message.
The directory was correctly created by postfixadmin:
============================== server01:/home/mbox # ls -la total 12 drwxrwx--x 3 postfix postfix 4096 Jun 15 14:36 . drwxr-xr-x 5 root root 4096 Jun 12 15:52 .. drwx------ 3 postfix postfix 4096 Jun 15 14:36 example.org
Any ideas?
Thanks a lot in advance
Saluti G.Bartolini Linux User #333064
First, tell me few things:
Output of command #cat /PATH/TO/POSTFIX_DIR/main.cf | grep virtual
Output of command #cat /PATH/TO/POSTFIXADMIN_DIR/config.inc.php | grep domain_in_mailbox
Regards, Dumitru
-----Original Message----- From: Dumitru Negara [mailto:dumitru@itcnetworks.ro] Sent: Friday, June 16, 2006 9:40 AM
Hello Dumitru,
First, tell me few things:
- Output of command #cat /PATH/TO/POSTFIX_DIR/main.cf | grep virtual
Ok
========================== virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_gid_maps = static:51 virtual_mailbox_base = /home/mbox virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_minimum_uid = 51 virtual_transport = virtual virtual_uid_maps = static:51
- Output of command #cat /PATH/TO/POSTFIXADMIN_DIR/config.inc.php | grep domain_in_mailbox
========================== $CONF['domain_in_mailbox'] = 'YES';
For your information:
========================== server01:~ # id postfix uid=51(postfix) gid=51(postfix) groups=51(postfix)
Do you think there's something wrong?
Saluti G.Bartolini Linux User #333064
Hi Gianfranco,
Gianfranco Bartolini wrote:
-----Original Message----- From: Dumitru Negara [mailto:dumitru@itcnetworks.ro] Sent: Friday, June 16, 2006 9:40 AM
Hello Dumitru,
First, tell me few things:
- Output of command #cat /PATH/TO/POSTFIX_DIR/main.cf | grep virtual
Ok
========================== virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_gid_maps = static:51 virtual_mailbox_base = /home/mbox virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_minimum_uid = 51 virtual_transport = virtual virtual_uid_maps = static:51
- Output of command #cat /PATH/TO/POSTFIXADMIN_DIR/config.inc.php | grep domain_in_mailbox
========================== $CONF['domain_in_mailbox'] = 'YES';
For your information:
========================== server01:~ # id postfix uid=51(postfix) gid=51(postfix) groups=51(postfix)
Do you think there's something wrong?
Saluti G.Bartolini Linux User #333064
No, it looks ok. The only thing I can suggest is to change a line in dovecot-sql.conf from
user_query = SELECT maildir AS mail, 51 AS uid, 51 AS gid FROM mailbox WHERE username = '%u' AND active = '1'
to
user_query = SELECT maildir AS mail, SELECT maildir, CONCAT('/home/mbox',maildir) AS home, 51 AS uid, 51 AS gid FROM mailbox WHERE username = '%u' AND active = '1'
Regards, Dumitru
-----Original Message----- From: dovecot-bounces@dovecot.org [mailto:dovecot-bounces@dovecot.org] On Behalf Of Dumitru Negara Sent: Saturday, June 17, 2006 12:30 PM
Hi Dumitru,
No, it looks ok. The only thing I can suggest is to change a line in dovecot-sql.conf from
user_query = SELECT maildir AS mail, 51 AS uid, 51 AS gid FROM mailbox WHERE username = '%u' AND active = '1'
to
user_query = SELECT maildir AS mail, SELECT maildir, CONCAT('/home/mbox',maildir) AS home, 51 AS uid, 51 AS gid FROM mailbox WHERE username = '%u' AND active = '1'
Ok, thanks for your hint, now it works well with the line below:
user_query = SELECT maildir, CONCAT('/home/mbox/',maildir) AS mail, 51 AS uid, 51 AS gid FROM mailbox WHERE username = '%u' AND active = '1'
I didn't realized why dovecot ignore the directory prefix, but that's it.
Thanks again for your kindly support!
Saluti G.Bartolini Linux User #333064
participants (4)
-
Dumitru Negara
-
Gianfranco Bartolini
-
Jakob Hirsch
-
Joseba Torre