#!/bin/sh # # spamc.sh # # Simple filter to plug SpamAssassin only # into the Postfix MTA, using the spamc / spamd # daemon version of SpamAssassin. # # (Should result in higher performance on busy servers) # # NOTE: spamd must be running before using this script! # # From http://advosys.ca/papers/postfix-filtering.html # Advosys Consulting Inc., Ottawa # # For use with: # Postfix 20010228 or later # SpamAssassin 2.42 or later # # Note: Modify the file locations to match your particular # server # File locations: # (CHANGE AS REQUIRED TO MATCH YOUR SERVER) SENDMAIL="/usr/lib/sendmail -i" ANOMY=/usr/local/anomy ANOMY_CONF=/usr/local/anomy/anomy.conf ANOMY_LOG=/dev/null SPAMC=/usr/bin/spamc export ANOMY # Exit codes from EX_TEMPFAIL=75 EX_UNAVAILABLE=69 cat | $SPAMC -f -u filter 2>/dev/null \ | $ANOMY/bin/sanitizer.pl $ANOMY_CONF 2>>$ANOMY_LOG \ | $SENDMAIL "$@" || \ { echo Message content rejected; exit $EX_UNAVAILABLE; } exit 0