Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've got a mailserver with Postfix, Dovecot, saslauthd and a MySQL storage and auth backend. I can send emails just fine, however receiving emails (from Outlook in this case) fails with messages in /var/log/mysql/mysql.log:

The MySQL log shows these errors:

53 Connect   mail@localhost on mail
53 Connect   Access denied for user 'mail'@'localhost' (using password: YES)
54 Connect   mail@localhost on mail
54 Connect   Access denied for user 'mail'@'localhost' (using password: YES)
55 Connect   mail@localhost on mail
55 Connect   Access denied for user 'mail'@'localhost' (using password: YES)
56 Connect   mail@localhost on mail
56 Connect   Access denied for user 'mail'@'localhost' (using password: YES)

It appears I can't log in to the MySQL server, however, when I do

mysql -u mail -p -h localhost

I can log in fine. The password is known to be correct in both cases.

I have a feeling that this is all caused by Postfix (and subsequently SMTPD I think?) being run in a chroot jail in /var/spool/postfix. I've tried disabling chroot and mounting mysql.sock to a folder in the Postfic chroot, however nothing changes.

I've also tried changing instances of 127.0.0.1 to localhost and vice versa to no avail. Google has been sapped dry by my attempts to find a solution. Maybe I'm searching for the wrong thing.

What do I need to do to allow Postfix to access a MySQL database running on the same server? I want to use MySQL for other things like PHP, so a Postfix-exclusive solution isn't really an option. This has been troubling me for a good 3 days now and I've attempted all the solutions out there.

My /etc/postfix/sasl/smtpd.conf looks like this:

pwcheck_method: auxprop
mech_list: PLAIN LOGIN
log_level: 7
allow_plaintext: true
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: localhost
sql_user: mail
sql_passwd: [hidden]
sql_database: mail
sql_select: select password from mailbox where username='%u@%r' and active = 1

I'm unsure what other files to post, so please comment and I will update accordingly. I'm running Ubuntu Server 12.10 32 bit.

share|improve this question
    
Does your password have any non alphanumeric characters in it? I've had some strange issues with that, they worked from the command line, but it just wouldn't connect in any other manner.. getting rid of those odd characters solved the issue. –  NickW Feb 28 '13 at 16:21
    
The password only consists of lowercase, uppercase and numbers, so I can't apply that nice simple fix :( –  Bojangles Feb 28 '13 at 16:22
    
It's not anything like apparmor is it? –  NickW Feb 28 '13 at 16:50
    
AppArmor isn't installed, so no –  Bojangles Feb 28 '13 at 18:08

1 Answer 1

up vote 0 down vote accepted

This was an utterly stupid mistake on my part. It turns out that in the config file /etc/postfix/sasl/smtpd.conf, there was a space after the sql_passwd and other fields, meaning auth failed. Oh dog I feel so stupid.

share|improve this answer
    
At least it works :) –  NickW Mar 1 '13 at 9:28
    
Very true, but now I've got more problems (beyond the scope of my original question) –  Bojangles Mar 1 '13 at 9:36
    
What sort of issues? –  NickW Mar 1 '13 at 9:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.