OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
RE: Postfix, Sasl and MySQL

From: Ray Anderson (rsarb-com.com)
Date: Mon Feb 02 2004 - 13:19:23 CST


You need saslauthd and the pam-mysql plugin to do this. This is running on
Mandrake 9.2. There's an rpm in the contrib directory.

My /etc/sysconfig/saslauthd file looks like this:
#############################
# $Id: saslauthd.sysconfig,v 1.1 2001/05/02 10:55:48 wiget Exp $
# Authentications mechanism (for list see saslauthd -v)
SASL_AUTHMECH=pam

# Hostname for remote IMAP server (if rimap auth mech is used)
# Ldap configuration file (if ldap auth mech is used)
SASL_MECH_OPTIONS=

# Extra options (for list see saslauthd -h)
SASLAUTHD_OPTS=
#
#############################

My /etc/pam.d/smtp, imap, and pop files are all the same. They look like
this:
#############################
#%PAM-1.0

# crypt = 2 to use the mysql password function!!!!!
# If crypt = 1, then use the mysql encrypt('foo') function

# Mail services
auth sufficient /lib/security/pam_mysql.so user=<MY MAIL USER> passwd=<MY
SUPER SECRET PASSWORD> host=localhost db=<MY MAIL DATABASE> table=<MY USER
ACCOUNT TABLE> usercolumn=<MY USERNAME COLUMN> passwdcolumn=<MY PASSWORD
COLUMN> crypt=2

auth required /lib/security/pam_mysql.so user=<MY MAIL USER> passwd=<MY
SUPER SECRET PASSWORD> host=localhost db=<MY MAIL DATABASE> table=<MY USER
ACCOUNT TABLE> usercolumn=<MY USERNAME COLUMN> passwdcolumn=<MY PASSWORD
COLUMN> crypt=2
#
#############################

As I stated in a prior e-mail, my /etc/postfix/sasl/smtpd.conf file looks
like this:
#############################
#
pwcheck_method = saslauthd
#
#############################

Hope this helps.

-=Ray
---------------------------------------
The winner (of an air battle) may have been determined by the amount of
time, energy, thought and training an individual has previously accomplished
in an effort to increase his ability as a fighter pilot.
Commander Randy "Duke" Cunningham, USN, 5 Victories, Vietnam Conflict

> I noticed afterward some of you were doing sasl auth with
> mysql via pam. I
> didnt see anyone post thier pam smtp config file. Someone mind posting
> your pam config as well as your smtpd.conf? This should allow
> me to get
> this working crypted instead of plain text.
>
> Thanks,
> Justin
>
>
>