====== procmail ====== ===== Information ===== Setup procmail to handle mail filtering. ===== Installation ===== # cd /usr/ports/mail/procmail # make install clean ===== Configuration ===== ==== Sendmail ==== First we have to rebuild ''sendmail'''s cf file to include procmail. ''/usr/src/contrib/sendmail/cf/README'' has some notes on that. - Copy ''/usr/src/etc/sendmail/freebsd.mc'' to a new filename:\\ # cd /usr/src/etc/sendmail # cp freebsd.mc custom.mc - Edit ''custom.mc'' - we need to add the following:\\ --- freebsd.mc Tue Aug 22 23:31:00 2006 +++ shalom.mc Mon Sep 3 00:02:42 2007 @@ -44,15 +44,16 @@ # divert(0) -VERSIONID(`$FreeBSD: src/etc/sendmail/freebsd.mc,v 1.30.2.2 2006/08/23 03:31:00 gshapiro Exp $') +VERSIONID(`$FreeBSD: src/etc/sendmail/shalom.mc,v 1.00.0.0 2007/09/02 23:54:00 john Exp $') OSTYPE(freebsd6) DOMAIN(generic) FEATURE(access_db, `hash -o -T /etc/mail/access') FEATURE(blacklist_recipients) -FEATURE(local_lmtp) +dnl FEATURE(local_lmtp) FEATURE(mailertable, `hash -o /etc/mail/mailertable') FEATURE(virtusertable, `hash -o /etc/mail/virtusertable') +FEATURE(`local_procmail',`',`procmail -t -Y -a $h -d $u') dnl Uncomment to allow relaying based on your MX records. dnl NOTE: This can allow sites to use your server as a backup MX without @@ -83,10 +84,14 @@ dnl Enable for both IPv4 and IPv6 (optional) DAEMON_OPTIONS(`Name=IPv4, Family=inet') -DAEMON_OPTIONS(`Name=IPv6, Family=inet6, Modifiers=O') +dnl DAEMON_OPTIONS(`Name=IPv6, Family=inet6, Modifiers=O') define(`confBIND_OPTS', `WorkAroundBrokenAAAA') define(`confNO_RCPT_ACTION', `add-to-undisclosed') define(`confPRIVACY_FLAGS', `authwarnings,noexpn,novrfy') + +dnl# Also accept mail for localhost.localdomain: +dnl LOCAL_DOMAIN(`localhost.localdomain')dnl MAILER(local) MAILER(smtp) +MAILER(procmail) - Build your ''custom.mc'' (or in my case, ''shalom.mc'') file:\\ # m4 -D_CF_DIR_=/usr/src/etc/sendmail/../../contrib/sendmail/cf/ /usr/src/etc/sendmail/../../contrib/sendmail/cf/m4/cf.m4 shalom.mc > shalom.cf - Copy the new sendmail cf file into place (and also copy the mc file):\\ # cp custom.* /etc/mail/ - Backup the current cf file:\\ # cd /etc/mail # cp sendmail.cf sendmail.cf.orig - Copy your new cf into place:\\ # cp custom.cf sendmail.cf - Restart Sendmail:\\ # /etc/rc.d/sendmail restart ==== Procmail ==== Setup a default global procmail file (''/usr/local/etc/procmailrc''): # Please check if all the paths in PATH are reachable, remove the ones that # are not. PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:. MAILDIR=$HOME/mail # You'd better make sure it exists DEFAULT=/var/mail/$LOGNAME LOGFILE=$MAILDIR/log.file VERBOSE=yes LOCKFILE=$HOME/.lockmail # Anything that has not been delivered by now will go to $DEFAULT # using LOCKFILE=$DEFAULT$LOCKEXT Eventually this file will have spam filtering options configured (after I setup [[spamassassin]]) ===== Notes ===== ================================================================ =============== If you are a system administrator you should consider integrating procmail into the mail-delivery system -- for advanced functionality, speed AND SECURITY --. For more information about this topic you should look in the examples/advanced file. ================================================================ =============== If you would like to inspect the results before running make install: All installable files can be found in the new/ subdirectory. ===== Reference Links ===== * [[http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/procmail.html]] * [[http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sendmail.html]] == \\ \\ {{tag>:freebsd}}