Edited from html file found on: http://docs.snake.de/smtp-auth.html
This is a quick description of how to use
SMTP Authorisation with sendmail
on both sides (client and server).
This description is FreeBSD specific but the general way to go is basically
the same on any other BSD or Unix-like system. It is assumed that you have
basic knowledge about sendmail configuration and FreeBSD port installation.
You have to recompile sendmail with the SASL library linked into it.
There are 2 major versions, SASL1 and SASL2. I'm using SASL2 and have no
problems, so the following stuff handles only SASL2.
The easiest way on FreeBSD is, to install the cyrus-sasl2 port from
/usr/ports/security/cyrus-sasl2 and activate the SASL2 support for sendmail in /etc/make.conf by adding the following lines:
SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2
SENDMAIL_LDFLAGS=-L/usr/local/lib
SENDMAIL_LDADD=-lsasl2
After having installed the port and added the SENDMAIL-lines above you can
recompile sendmail and reinstall it:
cd /usr/src/usr.sbin/sendmail
make clean depend all install
If you get errors compiling sendmail about missing libsmutil and libsm libraries, clean you obj directory first and rebuild those libraries and try again, eg.
rm -rf /usr/obj/*
cd /usr/src/lib/libsmutil ; make depend all
cd /usr/src/lib/libsm ; make depend all
cd /usr/src/usr.sbin/sendmail
make clean depend all install
Make sure sendmail gets started by setting sendmail_enable="YES" in /etc/rc.conf and don't forget to (re-)start it after that:
sh /etc/rc.sendmail stop
sh /etc/rc.sendmail start
(No, restart won't do it, run stop and start)
Required steps on client side:
Setup your smart host (default mail server with smtp auth) in your sendmail
config either by adding
define(`SMART_HOST', `your_smart_host')dnl
Lucas Koorneef:
diff freebsd.mc bsd1.mc
55a56,58
> dnl Lucas Koorneef: 2005-06-17:
> dnl added to use the onsnet mailserver for outgoing mail
> FEATURE(`authinfo',`hash -o /etc/mail/authinfo.db')
77c80,81
< dnl define(`SMART_HOST', `your.isp.mail.server')
---
> dnl Lucas Koorneef: 2005-06-17:
> define(`SMART_HOST', `mail.onsneteindhoven.nl')
-> use make to get a .cf file from the .mc file:
make bsd1.cf
cp bsd1.cf sendmail.cf
AuthInfo:your_smart_host "U:user" "P:password" "R:realm" "M:auth-method"
Lucas Koorneef:
-> make the authinfo file: (should be read only to root):
vim authinfo: -> AuthInfo:mail.onsneteindhoven.nl "U:xxxxxx" "P:xxxxxx" "M:PLAIN"
-> make the authinfo.db file:
makemap hash /etc/mail/authinfo < /etc/mail/authinfo
Links for this topic:
SMTP AUTH in sendmail 8.10-8.12 (from sendmail.org)
The corresponding chapter of the FreeBSD manual (contains description for SASLv1)