Nasser Heidari

2009-07-24

SMTP Auth – Postfix and SASL (Debian)

Filed under: Linux — Nasser Heidari @ 07:06
# apt-get install sasl2-bin libsasl2 libsasl2-modules

Now edit /etc/default/saslauthd:

START=yes

Now we should create /etc/postfix/sasl/smtpd.conf :

pwcheck_method: saslauthd
mech_list: PLAIN LOGIN

Ok, let’s add some lines in /etc/postfix/main.cf to enable SASL:

smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous

smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination

postfix does a chroot so it can’t communicate with saslauthd. This is the tricky part:

# rm -r /var/run/saslauthd/
# mkdir -p /var/spool/postfix/var/run/saslauthd
# ln -s /var/spool/postfix/var/run/saslauthd /var/run
# chgrp sasl /var/spool/postfix/var/run/saslauthd
# adduser postfix sasl 

Now restart postfix and start saslauthd

# invoke-rc.d postfix restart
# invoke-rc.d saslauthd start
Advertisements