Trouble with MYSQL Query

Lydiard lydiard at spamcop.net
Mon Dec 3 01:46:55 EST 2007


Hi

I recently had to port my old mail configuration to a new server - and  
afte many years of looking over my shoulder using pop-before-smtp, I  
decided to finally add in Cyrus-Sasl (not least because I thought I  
was recompiling Postfix from scratch - turns out I wasn't because  
Debian had beautiful packages that do it all for you, but that's not  
the issue here..

The how too I was following gave me this guideline:

pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: mail_admin
sql_passwd: mail_admin_password
sql_database: mail
sql_select: select password from users where email = '%u'


Which I subsqueqently changed to this with a little help from my postfix book:

# Global Parameters
log_level: 3
pwcheck_method: auxprop
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
allow_plaintext: true
# saslauthd Parameters
saslauthd_path: /var/spool/postfix/var/run/saslauthd/mux
# Auxiliary Plugin Paramters
auxprop_plugin: sql
sql_engine: mysql
sql_hostnames: localhost
sql_user: postfix
sql_passwd: *******i
sql_database: Mail
sql_select: select password from MailAccounts where Username = '%u';
sql_usessl: no

After much tweaking, this configuration does finally do an SQL query  
against the DB - however, the server is hosting several domains and  
this %u is causing me some issue..

Although I'm logging in with user at example.com, only example.com is  
being passed to the query - and hence failing.

Adding %r tries to concatenate example.com with example.net (the  
server domain).

I've googled strenuously for the last 5 hours, but I'm admitting  
defeat - what goes into my sql_select if my users clients are logging  
in with user at example.com/password?

I'm running Postfix on Debian etch, with TLS, MYSQL, and  
Courier-imap/pop3 - adding colums to my db tables is not really the  
answer I'm hoping to get :)

Lydiard



More information about the Cyrus-sasl mailing list