SMTP-Auth funktioniert nicht mit MySQL

Postfix, QMail, Sendmail, Dovecot, Cyrus, Courier, Anti-Spam
andreask2
Posts: 696
Joined: 2004-01-27 14:16
Location: Aachen
 

SMTP-Auth funktioniert nicht mit MySQL

Post by andreask2 »

Hallo!

Ich habe Postfix, Courier, libsasl... nach folgender Anleitung installiert: http://help.ubuntu.com/community/Postfi ... ystemHowto
Was nicht funktioniert ist die Authentifizierung über SMTP, die über die MySQL Datenbank stattfinden soll.

Ich habe das Gefühl, dass die Datenbank gar nicht erst abgefragt wird. Wenn ich mich verbinde, sehe ich:

Code: Select all

250-STARTTLS
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN NTLM PLAIN
250-AUTH=DIGEST-MD5 CRAM-MD5 LOGIN NTLM PLAIN
Aber wenn ich mich versuche zu authentifizieren (auch über E-Mail Client) funktioniert das nicht und es steht folgendes in den Logs:

Code: Select all

Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication failure: no secret in database
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: unknown[111.222.333.444]: SASL NTLM authentication failed: authentication failure
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication failure: no secret in database
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: unknown[111.222.333.444]: SASL CRAM-MD5 authentication failed: authentication failure
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: SASL authentication failure: Password verification failed
Sep 23 15:50:37 example postfix/smtpd[28477]: warning: unknown[111.222.333.444]: SASL PLAIN authentication failed: authentication failure
Was will er denn von "/etc/sasldb2"? Abgesehen davon, dass es die Datei nicht gibt, wird die ja eigentlich dazu verwendet um darin Passwörter zu speichern, aber die sollen ja in MySQL stehen.

Ich frage mich auch, ob ich den saslauthd (über "pam") überhaupt brauche. Das lese ich zwar oft als mögliche Lösung, aber wenn ich das richtig verstanden habe, funktioniert das auch ohne. Jedenfalls wurde dieser im oben verlinkten HOWTO nicht verwendet. Würde gerne auf einen zusätzlichen Dienst verzichten, wenn ich den nicht wirklich brauche. Oder hat das Teil irgendwelche besonderen Vorteile?

meine /etc/postfix/main.cf sieht so aus:

Code: Select all

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

mydomain = example.com
myhostname = mail.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
#mydestination = # localhost
#relayhost = #
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

# Virtual Mailbox Domain Settings

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit = 51200000
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual

# Additional for quota support

virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes

# SMTP Auth
#smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unauth_destination, check_policy_service inet
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unauth_destination, check_policy_service
# modify the existing smtpd_sender_restrictions
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
# then add these
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_path = /etc/postfix/sasl:/usr/lib/sasl2
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
Und die etc/postfix/sasl/smtpd.conf:

Code: Select all

pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: plain login cram-md5 digest-md5
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: postfix
sql_passwd: geheim
sql_database: postfix
sql_select: select passwd from mailbox where username='%u@%r' and active = 1
Postfix läuft im chroot. IMAP... funktioniert wunderbar. Nur eben SMTP-AUTH nicht. Jemand ne Idee?

Grüße
Andreas
andreask2
Posts: 696
Joined: 2004-01-27 14:16
Location: Aachen
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by andreask2 »

Hier noch ein Auszug aus der /var/log/auth.log

Code: Select all

Sep 24 09:18:36 example postfix/smtpd[32738]: sql_select option missing
Sep 24 09:18:36 example postfix/smtpd[32738]: auxpropfunc error no mechanism available 
Sep 24 09:18:36 example postfix/smtpd[32738]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql
libsasl2-modules-sql ist installiert. Ich verstehe es nicht.

Hier noch die Ausgabe von saslfinger -c:

Code: Select all

saslfinger - postfix Cyrus sasl configuration Mi 24. Sep 10:12:23 CEST 2008
version: 1.0.4
mode: client-side SMTP AUTH

-- basics --
Postfix: 2.5.1
System: Ubuntu 8.04.1 n l

-- smtp is linked to --
        libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00007faf7001a000)

-- active SMTP AUTH and TLS parameters for smtp --
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


-- listing of /usr/lib64/sasl2 --
total 924
drwxr-xr-x  2 root root  4096 2008-09-11 17:49 .
drwxr-xr-x 54 root root 20480 2008-09-12 14:23 ..
-rw-r--r--  1 root root 19196 2008-04-09 23:49 libanonymous.a
-rw-r--r--  1 root root   862 2008-04-09 23:48 libanonymous.la
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2.0.22
-rw-r--r--  1 root root 22186 2008-04-09 23:49 libcrammd5.a
-rw-r--r--  1 root root   848 2008-04-09 23:48 libcrammd5.la
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2.0.22
-rw-r--r--  1 root root 60688 2008-04-09 23:49 libdigestmd5.a
-rw-r--r--  1 root root   871 2008-04-09 23:48 libdigestmd5.la
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2.0.22
-rw-r--r--  1 root root 19366 2008-04-09 23:49 liblogin.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 liblogin.la
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2.0.22
-rw-r--r--  1 root root 38980 2008-04-09 23:49 libntlm.a
-rw-r--r--  1 root root   836 2008-04-09 23:48 libntlm.la
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2.0.22
-rw-r--r--  1 root root 19406 2008-04-09 23:49 libplain.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 libplain.la
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2.0.22
-rw-r--r--  1 root root 29764 2008-04-09 23:49 libsasldb.a
-rw-r--r--  1 root root   873 2008-04-09 23:48 libsasldb.la
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2.0.22
-rw-r--r--  1 root root 33576 2008-04-09 23:49 libsql.a
-rw-r--r--  1 root root   971 2008-04-09 23:48 libsql.la
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2.0.22

-- listing of /usr/lib/sasl2 --
total 924
drwxr-xr-x  2 root root  4096 2008-09-11 17:49 .
drwxr-xr-x 54 root root 20480 2008-09-12 14:23 ..
-rw-r--r--  1 root root 19196 2008-04-09 23:49 libanonymous.a
-rw-r--r--  1 root root   862 2008-04-09 23:48 libanonymous.la
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2.0.22
-rw-r--r--  1 root root 22186 2008-04-09 23:49 libcrammd5.a
-rw-r--r--  1 root root   848 2008-04-09 23:48 libcrammd5.la
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2.0.22
-rw-r--r--  1 root root 60688 2008-04-09 23:49 libdigestmd5.a
-rw-r--r--  1 root root   871 2008-04-09 23:48 libdigestmd5.la
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2.0.22
-rw-r--r--  1 root root 19366 2008-04-09 23:49 liblogin.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 liblogin.la
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2.0.22
-rw-r--r--  1 root root 38980 2008-04-09 23:49 libntlm.a
-rw-r--r--  1 root root   836 2008-04-09 23:48 libntlm.la
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2.0.22
-rw-r--r--  1 root root 19406 2008-04-09 23:49 libplain.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 libplain.la
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2.0.22
-rw-r--r--  1 root root 29764 2008-04-09 23:49 libsasldb.a
-rw-r--r--  1 root root   873 2008-04-09 23:48 libsasldb.la
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2.0.22
-rw-r--r--  1 root root 33576 2008-04-09 23:49 libsql.a
-rw-r--r--  1 root root   971 2008-04-09 23:48 libsql.la
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2.0.22

-- listing of /etc/postfix/sasl --
total 12
drwxr-xr-x 2 root root 4096 2008-09-11 19:26 .
drwxr-xr-x 3 root root 4096 2008-09-23 14:54 ..
-rw-r--r-- 1 root root  275 2008-09-23 18:57 smtpd.conf


Cannot find the smtp_sasl_password_maps parameter in main.cf.
Client-side SMTP AUTH cannot work without this parameter!
Und hier noch saslfinger -s:

Code: Select all

saslfinger - postfix Cyrus sasl configuration Mi 24. Sep 10:22:23 CEST 2008
version: 1.0.4
mode: server-side SMTP AUTH

-- basics --
Postfix: 2.5.1
System: Ubuntu 8.04.1 n l

-- smtpd is linked to --
        libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00007f9308043000)

-- active SMTP AUTH and TLS parameters for smtpd --
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = 
smtpd_sasl_path = /etc/postfix/sasl:/usr/lib/sasl2
smtpd_sasl_security_options = noanonymous
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes


-- listing of /usr/lib64/sasl2 --
total 924
drwxr-xr-x  2 root root  4096 2008-09-11 17:49 .
drwxr-xr-x 54 root root 20480 2008-09-12 14:23 ..
-rw-r--r--  1 root root 19196 2008-04-09 23:49 libanonymous.a
-rw-r--r--  1 root root   862 2008-04-09 23:48 libanonymous.la
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2.0.22
-rw-r--r--  1 root root 22186 2008-04-09 23:49 libcrammd5.a
-rw-r--r--  1 root root   848 2008-04-09 23:48 libcrammd5.la
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2.0.22
-rw-r--r--  1 root root 60688 2008-04-09 23:49 libdigestmd5.a
-rw-r--r--  1 root root   871 2008-04-09 23:48 libdigestmd5.la
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2.0.22
-rw-r--r--  1 root root 19366 2008-04-09 23:49 liblogin.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 liblogin.la
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2.0.22
-rw-r--r--  1 root root 38980 2008-04-09 23:49 libntlm.a
-rw-r--r--  1 root root   836 2008-04-09 23:48 libntlm.la
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2.0.22
-rw-r--r--  1 root root 19406 2008-04-09 23:49 libplain.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 libplain.la
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2.0.22
-rw-r--r--  1 root root 29764 2008-04-09 23:49 libsasldb.a
-rw-r--r--  1 root root   873 2008-04-09 23:48 libsasldb.la
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2.0.22
-rw-r--r--  1 root root 33576 2008-04-09 23:49 libsql.a
-rw-r--r--  1 root root   971 2008-04-09 23:48 libsql.la
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2.0.22

-- listing of /usr/lib/sasl2 --
total 924
drwxr-xr-x  2 root root  4096 2008-09-11 17:49 .
drwxr-xr-x 54 root root 20480 2008-09-12 14:23 ..
-rw-r--r--  1 root root 19196 2008-04-09 23:49 libanonymous.a
-rw-r--r--  1 root root   862 2008-04-09 23:48 libanonymous.la
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2
-rw-r--r--  1 root root 15888 2008-04-09 23:49 libanonymous.so.2.0.22
-rw-r--r--  1 root root 22186 2008-04-09 23:49 libcrammd5.a
-rw-r--r--  1 root root   848 2008-04-09 23:48 libcrammd5.la
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2
-rw-r--r--  1 root root 19184 2008-04-09 23:49 libcrammd5.so.2.0.22
-rw-r--r--  1 root root 60688 2008-04-09 23:49 libdigestmd5.a
-rw-r--r--  1 root root   871 2008-04-09 23:48 libdigestmd5.la
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2
-rw-r--r--  1 root root 48448 2008-04-09 23:49 libdigestmd5.so.2.0.22
-rw-r--r--  1 root root 19366 2008-04-09 23:49 liblogin.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 liblogin.la
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2
-rw-r--r--  1 root root 16432 2008-04-09 23:49 liblogin.so.2.0.22
-rw-r--r--  1 root root 38980 2008-04-09 23:49 libntlm.a
-rw-r--r--  1 root root   836 2008-04-09 23:48 libntlm.la
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2
-rw-r--r--  1 root root 32368 2008-04-09 23:49 libntlm.so.2.0.22
-rw-r--r--  1 root root 19406 2008-04-09 23:49 libplain.a
-rw-r--r--  1 root root   842 2008-04-09 23:48 libplain.la
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2
-rw-r--r--  1 root root 16336 2008-04-09 23:49 libplain.so.2.0.22
-rw-r--r--  1 root root 29764 2008-04-09 23:49 libsasldb.a
-rw-r--r--  1 root root   873 2008-04-09 23:48 libsasldb.la
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2
-rw-r--r--  1 root root 21528 2008-04-09 23:49 libsasldb.so.2.0.22
-rw-r--r--  1 root root 33576 2008-04-09 23:49 libsql.a
-rw-r--r--  1 root root   971 2008-04-09 23:48 libsql.la
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2
-rw-r--r--  1 root root 27904 2008-04-09 23:49 libsql.so.2.0.22

-- listing of /etc/postfix/sasl --
total 12
drwxr-xr-x 2 root root 4096 2008-09-11 19:26 .
drwxr-xr-x 3 root root 4096 2008-09-24 10:15 ..
-rw-r--r-- 1 root root  275 2008-09-23 18:57 smtpd.conf




-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: plain login cram-md5 digest-md5
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_database: postfix
sql_select: select password from mailbox where username='%u@%r' and active = 1

-- content of /etc/postfix/sasl/smtpd.conf --
pwcheck_method: auxprop
auxprop_plugin: sql
mech_list: plain login cram-md5 digest-md5
sql_engine: mysql
sql_hostnames: 127.0.0.1
sql_user: --- replaced ---
sql_passwd: --- replaced ---
sql_database: postfix
sql_select: select password from mailbox where username='%u@%r' and active = 1


-- active services in /etc/postfix/master.cf --
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
smtp      inet  n       -       -       -       -       smtpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
        -o smtp_fallback_relay=
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -       n       n       -       2       pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

-- mechanisms on localhost --
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN NTLM PLAIN
250-AUTH=DIGEST-MD5 CRAM-MD5 LOGIN NTLM PLAIN


-- end of saslfinger output --
Kann das was mit chroot zu tun haben? Wenn ich aber in der master.cf ein "n" bei smtp einfüge und neu starte, passiert dasselbe.

Wieso wird das SQL Modul nicht gefunden?
User avatar
Joe User
Project Manager
Project Manager
Posts: 11185
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by Joe User »

andreask2 wrote:Hier noch die Ausgabe von saslfinger -c:

Code: Select all

Cannot find the smtp_sasl_password_maps parameter in main.cf.
Client-side SMTP AUTH cannot work without this parameter!
Behebe zunächst mal diesen Fehler...
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
User avatar
rudelgurke
Posts: 409
Joined: 2008-03-12 05:36
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by rudelgurke »

Nachdem dass gemacht wurde, klappen die Login Daten ? Hier nicht über socket, über TCP - evtl. fehlen da die Zugriffsrechte.
Und natürlich - sind die Client Bibliotheken installiert ? libmysql... usw. usw.
Im Grunde dass mit den Login Daten die Verbindung innerhalb des Chroot zu MySQL funktioniert
andreask2
Posts: 696
Joined: 2004-01-27 14:16
Location: Aachen
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by andreask2 »

Den Fehler habe ich behoben (bezog sich halt nur auf ausgehende Mails), und habe es mal mit saslauthd versucht, aber auch das klappt nicht. Mit testsaslauthd kann ich zwar saslauthd erfolgreich testen, aber dann muss es also am Zugriff durch Postfix /smtpd liegen.

Das ist meine neue /etc/postfix/sasl/smtpd.conf:

Code: Select all

pwcheck_method: saslauthd
mech_list: plain login
saslauthd_path: /var/spool/postfix/var/run/saslauthd/mux
Ich habe bei MySQL mal query log eingeschaltet. Wenn ich saslauthd mit folgendem Befehl teste (was wie gesagt funktioniert):

Code: Select all

testsaslauthd -u test3@example.com -p xxxxxx -s smtp -f /var/spool/postfix/var/run/saslauthd/mux
erscheint folgendes im query log:

Code: Select all

SELECT password FROM mailbox WHERE username = 'test3@example.com'
SELECT 0, password FROM mailbox WHERE username = 'test3@example.com'
Wenn ich dagegen versuche eine Mail über das entsprechende Konto über SMTP zu verschicken, erscheint das:

Code: Select all

SELECT username, password, "", '5000', '5000', '/home/vmail', maildir, concat(quota,'S'), name, "" FROM mailbox WHERE username = "test3@example.com"
Die query findet übrigens auch einen user, wenn ich das mal manuell ausführe. Allerdings sieht mir das eher nach einer Abfrage aus, die Courier erzeugt, denn da ist das sind die Werte genau so konfiguriert (mit diesen Anführungszeichen... /etc/courier/authmysqlrc).

In der /var/log/auth.log steht dann:

Code: Select all

Oct  1 13:17:01 example postfix/smtpd[17515]: sql_select option missing
Oct  1 13:17:01 example postfix/smtpd[17515]: auxpropfunc error no mechanism available 
Oct  1 13:17:01 example postfix/smtpd[17515]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql
Das passt halt gar nicht zu der /etc/postfix/sasl/smtpd.conf von oben. Postfix habe ich natürlich neu gestartet.
User avatar
Joe User
Project Manager
Project Manager
Posts: 11185
Joined: 2003-02-27 01:00
Location: Hamburg
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by Joe User »

andreask2 wrote:Postfix habe ich natürlich neu gestartet.
saslauthd auch? Klappt es denn, wenn Postfix nicht im Chroot steckt?
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
andreask2
Posts: 696
Joined: 2004-01-27 14:16
Location: Aachen
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by andreask2 »

Ja, alles neu gestartet...

Ich hab das gerade nochmal auf der Kommandozeile versucht. Der Server sendet mir:

Code: Select all

250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN NTLM PLAIN
Obwohl ich das in der smptd.conf was anderes eingestellt habe.

Dann habe ich mal die Zugangsdaten kodiert:

Code: Select all

perl -MMIME::Base64 -e 'print encode_base64("test3@example.com\0test3@example.com\0xxxxxx");'
und dann versucht mich zu authentifizieren:

Code: Select all

AUTH PLAIN dGVzdDMuY29tAHRlc3QzLmNvbQB0ZXN0Mw==
Ergebnis:

Code: Select all

535 5.7.8 Error: authentication failed: authentication failure
In der Datenbank kommt nur die courier Abfrage an, nicht die von saslauthd. Ob das ganze im chroot läuft oder nicht macht keinen Unterschied (hab in der master.cf chroot bei "smtp" auf "n" gesetzt).

Ich weiß echt nicht mehr wo ich noch ansetzen kann. Irgendwo läuft es falsch, aber wo?
andreask2
Posts: 696
Joined: 2004-01-27 14:16
Location: Aachen
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by andreask2 »

Das hat übrigens wohl doch nichts mit courier zu tun, in der main.cf von postfix bzw. den verlinkten virtual_* Dateien stehen ähnliche einstellungen. Aber wieso wird die SMTP Authentifizierung nicht wirklich verwendet?
User avatar
daemotron
Administrator
Administrator
Posts: 2641
Joined: 2004-01-21 17:44
 

Re: SMTP-Auth funktioniert nicht mit MySQL

Post by daemotron »

Ich hab schon länger keine Courier-Authlib mehr im Einsatz, aber AFAIR waren da zwei Dinge:
  • /etc/courier/authlib/authdaemonrc
    Wie ist authmodulelist definiert? Müsste eigentlich auf "authmysql" oder "authmysql pam" stehen.
  • /etc/courier/authlib/authmysqlrc
    Alle Werte richtig gesetzt? Verwendest Du MYSQL_CLEARPW_FIELD oder MYSQL_CRYPTPW_FIELD?
Mit welchen Optionen wird der saslauthd gestartet? Ist "-a rimap -r" dabei?
Und zu guter letzt: Läuft überhaupt courier-authlib? Denn saslauthd versucht ja wiederum, selbigen als Backend zu nutzen...