For When You Can't Have The Real Thing
[ start | index | login ]
start > cyrus > imap > sendmail

sendmail

Created by dave. Last edited by dave, 20 years and 52 days ago. Viewed 6,702 times. #5
[diff] [history] [edit] [rdf]
labels
attachments

Configuring Sendmail to work with Cyrus Imap

(note: version 8.12.11)

Building:

You need a devtools/Site/site.config.m4 like so:

APPENDDEF(`conf_sendmail_ENVDEF', `-DMILTER')
APPENDDEF(`conf_libmilter_ENVDEF', `-D_FFR_MILTER_ROOT_UNSAFE ') 
APPENDDEF(`confENVDEF', `-DSASL=2')
APPENDDEF(`conf_sendmail_LIBS', `-lsasl2')

If you are doing this with pieces in non-standard locations, you need to do something like this (this is a Solaris example):

APPENDDEF(`confLIBDIRS',`-L/opt/UXdmz/lib -R/opt/UXdmz/lib')
APPENDDEF(`confINCDIRS', `-I/opt/UXdmz/include -I/opt/UXdmz/include/sasl')

So:

cd libmilter
sh Build
cd ..
sh Build

You need two sendmail configurations: one which uses the relay rules for access (ie something that will accept email for domains that it knows about); and one which uses SMTP AUTH to permit remote clients to send email from arbitrary dial up IP addresses. Also note that we're doing MimeDefang/SpamAssassin here as well.

This is the sendmail.mc for the relay sendmail on port 25; process it and install as /etc/mail/sendmail.cf:

VERSIONID(`$Revision: 1.1 $')
OSTYPE(linux)
DOMAIN(generic)

MASQUERADE_AS(`gridway.net')

FEATURE(use_ct_file) FEATURE(use_cw_file) FEATURE(always_add_domain) FEATURE(allmasquerade) FEATURE(masquerade_envelope) FEATURE(accept_unresolvable_domains) FEATURE(access_db) FEATURE(mailertable) FEATURE(virtusertable) FEATURE(blacklist_recipients)

define(`confME_TOO', `True') define(`confBIND_OPTS', `+AAONLY') define(`confTO_IDENT',0s) define(`LOCAL_MAILER_PATH', `/usr/bin/mail') define(`LOCAL_MAILER_FLAGS', `lsDFMAw5:/|@q') define(`LOCAL_MAILER_ARGS', `/usr/bin/mail -d $u')

INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:60s;R:60s;E:5m')

MAILER(local) MAILER(smtp) MAILER(`cyrusv2')

This one is the SMPT AUTH instance; process it and install as /etc/mail/sendmail-sasl.cf:

VERSIONID(`$Revision: 1.1 $')
OSTYPE(linux)
DOMAIN(generic)

MASQUERADE_AS(`gridway.net')

FEATURE(use_ct_file) FEATURE(use_cw_file) FEATURE(always_add_domain) FEATURE(allmasquerade) FEATURE(masquerade_envelope) FEATURE(accept_unresolvable_domains) FEATURE(access_db) FEATURE(mailertable) FEATURE(virtusertable) FEATURE(blacklist_recipients)

FEATURE(no_default_msa) DAEMON_OPTIONS(`Addr=142.46.200.221, Port=587, Name=MSA, M=Ea') TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 PLAIN LOGIN') define(`confAUTH_MECHANISMS', `DIGEST-MD5 CRAM-MD5 PLAIN LOGIN')

define(`confME_TOO', `True') define(`confBIND_OPTS', `+AAONLY') define(`confTO_IDENT',0s) define(`LOCAL_MAILER_PATH', `/usr/bin/mail') define(`LOCAL_MAILER_FLAGS', `lsDFMAw5:/|@q') define(`LOCAL_MAILER_ARGS', `/usr/bin/mail -d $u')

INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:60s;R:60s;E:5m')

MAILER(local) MAILER(smtp) MAILER(`cyrusv2')

Also don't forget to process and install /etc/mail/submit.cf; you can make this (ideally before creating your custom sendmail.cf) by:

cd cf/cf
sh Build install-cf

Installing:

Since you uninstalled the OS-supplied sendmail first, you'll need some kind of init.d file:

#!/sbin/sh

case "$1" in 'start') if [ -f /usr/lib/sendmail -a -f /etc/mail/sendmail.cf ]; then if [ ! -d /var/spool/mqueue ]; then /usr/bin/mkdir -m 0700 /var/spool/mqueue /usr/bin/chown root:bin /var/spool/mqueue fi if [ ! -d /var/spool/clientmqueue ]; then mkdir /var/spool/clientmqueue chmod 770 /var/spool/clientmqueue chown smmsp:smmsp /var/spool/clientmqueue fi echo "Starting Sendmail." /usr/bin/sendmail -L sm-mta -bd -q15m & # Sendmail mta /usr/bin/sendmail -L sm-mta -bd -q15m -C /etc/mail/sendmail-sasl.cf & # Sendmail SMTP-AUTH mta /usr/bin/sendmail -L sm-msp-queue -Ac -q30m & # Client mqueue flush fi ;;

'stop') pids=`ps -fe | grep /usr/sbin/sendmail | grep -v grep | awk '{print $2}'` if [ ! -z "$pids" ]; then for i in $pids; do kill $i done fi ;;

*) echo "Usage: $0 { start | stop }" exit 1 ;; esac exit 0

On Linux you'll need to create /usr/man/man8 and /usr/man/man1 if they don't already exist.

Create user and group smmsp

Finally, run sh Build install to get it installed.

To get the SMTP AUTH sendmail to use the SASL db, you must have an /usr/lib/sasl2/Sendmail.conf (note: case-sensitive file name!) file:

pwcheck_method: auxprop
no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt