here's the postfix + SpamAssassin with SPAM Quarantine
same as you did with the basic script here
1. Install SpamAssassin
if you need any help visit
http://spamassassin.apache.org/
add a user call spamfilter with out shell.
CODE:
adduser spamfilter -s /sbin/nologin
[Copy to clipboard]
2. Setup Postfix
edit the master.cf
add the line
CODE:
spamfilter unix - n n - - pipe
flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter -f ${sender} -- ${recipient}
[Copy to clipboard]
edit the SMTP as
CODE:
smtp inet n - n - - smtpd
-o content_filter=spamfilter:dummy
[Copy to clipboard]
now create a file call
/usr/local/bin/spamfilter
eg
CODE:
vi /usr/local/bin/spamfilter
[Copy to clipboard]
QUOTE:
# Kalinga Athulathmudali
# 2006-01-06
# Variables
SENDMAIL="/usr/sbin/sendmail.postfix -i"
EGREP=/bin/egrep
# Exit codes from
EX_UNAVAILABLE=69
# Number of *'s in X-Spam-level header needed to sideline message:
# (Eg. Score of 5.5 = "*****" )
SPAMLIMIT=5
# Clean up when done or when aborting.
trap "rm -f /var/tempfs/out.$$" 0 1 2 3 15
# Pipe message to spamc
cat | /usr/bin/spamc -u filter /var/tempfs/out.$$
if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}"
then
## Change the Email address where you want your spam to get fwd to
$SENDMAIL -f spamadmin@yourdomain.com spamtrap@yourdomain.com
else
$SENDMAIL "$@"
fi
# Postfix returns the exit status of the Postfix sendmail command.
exit $?
now chnage the email address in script
your admin email address spamadmin@yourdomain.com
this is where your spam get fwd to spamtrap@yourdomain.com
now chnage the owner of the file to spamfilter
CODE:
chown spamfilter /usr/local/bin/spamfilter
[Copy to clipboard]
now set permisson as
QUOTE:
chmod 755 /usr/local/bin/spamfilter
creat a dir call tempfs in var
CODE:
mkdir /var/tempfs
[Copy to clipboard]
chnage the folder owner to spamfilter
CODE:
chown spamfilter:root /var/tempfs
[Copy to clipboard]
reload postfix
CODE:
/etc/init.d/postfix reload
[Copy to clipboard]
your done.
原文出处:
http://onetforum.com/fourm/viewtopic.php?t=34