Dennis: Konfiguration von SASL Auth für Postfix mit MySQL Backend

Hallo,

ich versuche derzeit verzweifelt meinem Postfix beizubringen, dass er Remote-Clients die Möglichkeit geben soll sich per SASL zu authentifizieren und anschließend Mails zu relayen.

Hierfür habe ich Postfix in der /etc/main.cf entsprechend konfiguriert:

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
broke_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous

smtpd_recipient_restrictions = permit_sasl_authenticated, [...]

Postfix sowie saslauthd habe ich neu gestartet, das ganze läuft auf einem Debian 4.0 Server.

Nun versuch ich mich per telnet-Verbindung zu authentifizieren:

driehle@s1:~$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 s1.example.com ESMTP
EHLO s1.example.com
250-s1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH PLAIN dGVzdAB0ZXN0AHRlc3RwYXNz
535 5.7.0 Error: authentication failed: authentication failure
QUIT
221 2.0.0 Bye
Connection closed by foreign host.

Anschließend weist /var/log/auth.log folgendes auf:

May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin Parse the username test@s1.example.com
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin try and connect to a host
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin trying to open db 'system' on host '127.0.0.1'
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin could not connect to host 127.0.0.1
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin couldn't connect to any host
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin Parse the username test@s1.example.com
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin try and connect to a host
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin trying to open db 'system' on host '127.0.0.1'
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin could not connect to host 127.0.0.1
May 30 14:18:36 s1 postfix/smtpd[26517]: sql plugin couldn't connect to any host

In /var/log/mail.log stehen folgende Zeilen, welche sich auch im syslog finden:

May 30 14:18:30 s1 postfix/smtpd[26517]: connect from localhost.localdomain[127.0.0.1]
May 30 14:18:36 s1 postfix/smtpd[26517]: warning: SASL authentication failure: Password verification failed
May 30 14:18:36 s1 postfix/smtpd[26517]: warning: localhost.localdomain[127.0.0.1]: SASL PLAIN authentication failed: authentication failure
May 30 14:18:38 s1 postfix/smtpd[26517]: disconnect from localhost.localdomain[127.0.0.1]

Offensichtlich kann Postfix bzw. der SASL-Authdeamon sich nicht mit der MySQL Datenbank verbinden. Das Problem scheint es öfters zu geben, wie Google-Suchen ergeben habe.

Als Problem wird hierbei meist erwähnt, dass der Authdeamon in einem chroot läuft und somit keinen Zugriff auf den MySQL Sockel hat.

Meine /etc/postfix/sasl/smtpd.conf sieht so aus:

auxprop_plugin: sql
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
log_level: 9
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_database: system
sql_user: mesc
sql_passwd: *****
sql_select: SELECT %p FROM mail_boxes WHERE address = '%u' AND password = '%r' AND status = 'A'
sql_usessl: no

Ein Ändern von 127.0.0.1 auf localhost bringt (entgegen diverser per Google gefundenen Meinungen) keine Lösung. Der Verbindungsaufbau zu MySQL über Kommandozeile klappt natürlich auch mit obigen Zugangsdaten.

Aus /etc/postfix/master.cf:

service type  private unpriv  chroot  wakeup  maxproc command + args

#               (yes)   (yes)   (yes)   (never) (100)

==========================================================================

smtp      inet  n       -       n       -       -       smtpd

Auch ein Deaktivieren des chroot hilft nicht weiter.

Mittlerweile bin ich nun etwas irritiert - kennt jemand von euch vielleicht dieses Problem und weiß, woran es liegen könnte, dass SASL keine Verbindung zur MySQL-Datenbank aufbauen kann?

Viele Grüße,
  ~ Dennis.