Postfix authentication with sasldb
Translation of the original in Catalan. Read it in: CatalàCastellano
Four notes I have pending to classify, how to give authentication support to postfix quickly and simply.
Packages to have in addition to postfix: cyrus-sasl, cyrus-sasl-md5.
Lines to have in /etc/postfix/main.cf:
smtpd_sasl_application_name = smtpd
smtpd_sasl_type = cyrus
smtpd_sasl_path = sasl2/smtpd.conf
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
Configuration file of the authentication service /etc/sasl2/smtpd.conf:
pwcheck_method: auxprop
auxprop_plugin: sasldb
mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
Make sure that the owner of the file /etc/sasldb2 is postfix.
The file /etc/sasldb2 is a Berkeley DB database that stores the users and their passwords in plain text. So, it is not very secure but a more than sufficient solution for many SOHO environments.
User management:
# afegir usuari
saslpasswd2 -a smtpd -u domini_exemple.com nom_usuari
# borrar usuari
saslpasswd2 -d -u domini_exemple.com nom_usuari
# llistar usuaris
sasldblistusers2
The configuration you have to put in the MUA as far as the mail server is concerned has to be of the type:
usuari: nom_usuari@domini_exemple.com
pass: el que hagiu definit
mecanisme d'autenticació suportats: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
UPDATE 27/2/2012:
In order to be able to have access to the file /etc/sasldb2 the smtpd module of postfix must not be launched as chroot. To avoid that the file /etc/postfix/master.cf has to be modified, specifically the line of the smtpd daemon has to remain like this:
smtp inet n - n - - smtpd
To have SASL support on Ubuntu Lucid the packages have to be installed: sasl2-bin and libsasl2-modules.