SASL2 + MySQL + Postfix

Postfix, QMail, Sendmail, Dovecot, Cyrus, Courier, Anti-Spam
blaue0
Posts: 22
Joined: 2004-06-25 00:37
 

SASL2 + MySQL + Postfix

Post by blaue0 »

Hallo,

ich sitze nun seit einer halben Ewigkeit vor dem selben Problem. Ich habe eine zentrale MySQL Datenbank auf Server s1.domain.tld. Postfix, Courier-IMAP und ein paar andere Dienste beziehen daraus vor allem ihre Userkonfiguration. Als Betriebssystem verwende ich Gentoo GNU/Linux.

Meiner Meinung nach sollte die Authentifizierung wie folgt ablaufen:
1. Client verbindet, sendet AUTH PLAIN blablubb
2. Postfix ruft mit der Cyrus-SASL2 Bibliothek die MySQL Datenbank ab und fragt dort ob die Kombination aus Usernamen und Passwort stimmt.
3. Entweder Reject oder Relay.

Wie man sehen kann, verwende ich keinen saslauthd. Dies sollte auch so bleiben, denn ich weiss das die Konfiguration so bereits mal funktioniert hat, geändert habe ich (meines Wissens) nichts.

Ich habe einen gepatchten Cyrus-SASL damit ich die Passwörter verschlüsselt mit der ENCRYPT() Funktion speichern kann.

Meine /etc/sasl2/smtpd.conf:

Code: Select all

pwcheck_method: auxprop
auxprop_plugin: sql
sql_engine:     mysql
mech_list:      PLAIN
sql_hostnames:  localhost
sql_user:       mysql_user
sql_passwd:     mysql_password
sql_database:   system
sql_verbose:    yes
sql_select:     SELECT Password FROM mail_users LEFT JOIN system_domains ON (system_domains.DomainID = mail_users.DomainID) LEFT JOIN system_servers ON (system_servers.ServerID = system_domains.ServerID) WHERE IP = 's1.domain.tld' AND Address = '%u@%r'
Postconf -n:

Code: Select all

alias_maps = mysql:/etc/postfix/maps/aliases.cf
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 10
home_mailbox = .maildir/
html_directory = /usr/share/doc/postfix-2.2.5/html
local_destination_concurrency_limit = 2
local_recipient_maps = mysql:/etc/postfix/maps/users.cf, $alias_maps
local_transport = local
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks_style = host
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.2.5/readme
relay_domains = $mydestination
relocated_maps = mysql:/etc/postfix/maps/relocated.cf
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/maps/forwarders.cf
virtual_create_maildirsize = yes
virtual_gid_maps = static:2000
virtual_mailbox_base = /
virtual_mailbox_domains = testserver-dmesg.servebbs.net
virtual_mailbox_limit_maps = mysql:/etc/postfix/maps/quota.cf
virtual_mailbox_limit_override = yes
virtual_mailbox_maps = mysql:/etc/postfix/maps/users.cf
virtual_maildir_limit_message = This mailbox is full
virtual_overquota_bounce = yes
virtual_transport = virtual
virtual_uid_maps = static:2000
Was habe ich vergessen, falsch eingetragen? Ich habe MySQL bereits gesagt, es soll alles nach /tmp/mysql.log loggen, dort wird nicht mal ein Query ausgeführt, welches von SASL2 kommt.
blaue0
Posts: 22
Joined: 2004-06-25 00:37
 

Re: SASL2 + MySQL + Postfix

Post by blaue0 »

Problem behoben, indem nun saslauthd verwendet wird.