Postfix and bogofilter
Jeremy Fowler
jfowler at westrope.com
Fri Oct 18 11:14:42 CDT 2002
Have you looked at SpamAssassin with amavisd-new? Postfix filters mail thru a
direct SMTP connection to localhost port 10024 where Amavisd scans the mail for
viruses and checks to see if it's spam and then either responds to Postfix with
a "550: content rejected" or sends it back into postfix on localhost port 10025.
Since AMaViSD is running as a Daemon, Postfix doesn't need to start a new
process each time an email comes in, so it's very fast.
http://www.ijs.si/software/amavisd/
http://spamassassin.org/
my master.cf file:
amavis-smtp unix - - y - 2 smtp
-o smtp_data_done_timeout=1200s
-o smtp_never_send_ehlo=yes
-o disable_dns_lookups=yes
localhost:10025 inet n - y - - smtpd
-o content_filter=
-o local_recipient_maps=
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
my main.cf file:
content_filter = amavis-smtp:localhost:10024
> -----Original Message-----
> From: owner-kclug at marauder.illiana.net
> [mailto:owner-kclug at marauder.illiana.net]On Behalf Of jim
> Sent: Friday, October 18, 2002 5:25 AM
> To: kclug at kclug.org
> Subject: Re: Postfix and bogofilter
>
>
> I think postfix/bogofilter is working good enough to tell how I did it. I
> don't have procmail installed, so this is how I did it without it. This is
> on a mailserver that handles mail for a small number of users.
>
> 1. Get postfix installed and running properly.
>
> 2. Get bogofilter installed and running properly from the command line.
>
> 3. Create a user, I used 'filter' as a username. This user should
> not be able
> to log in, but does need a home directory. I used '/home/filter'.
>
> 4. Put the bogofilter executable in /usr/sbin
>
> 5. Put the following script in /usr/sbin
>
> #!/bin/bash
>
> export PATH=$PATH:/usr/sbin
> export HOME=/home/filter
> cd $HOME
>
> bogofilter -p | sendmail -i "$@"
>
> 6. In the master.cf configuration file for postfix, find the line that looks
> like:
>
> smtp inet (some other stuff) smtpd
>
> and add this line after it.
>
> -o content_filter=filter:
>
> Be sure to include the ':' at the end of the line.
>
> 7. Append these lines to the end of the master.cf file:
>
> filter unix - n n - - pipe
> user=filter argv=/usr/sbin/filtermail -f ${sender} -- ${recipient}
>
> 8. Do a 'postfix reload'.
>
> 9. Now, anything bogofilter recognizes as spam will have a header that looks
> like:
>
> X-Spam-Status: Yes, tests=bogofilter
>
> and anything it doesn't think is spam will look like:
>
> X-Spam-Status: No, tests=bogofilter
>
> 10. Even though bogofilter is now filtering your email. It doesn't know what
> to look for to distinguish spam from real email. Create two other mail
> accounts, one for spam and one for non-spam. Anytime you receive spam that
> bogofilter doesn't catch, forward it to the spam address. Anytime you
> receive good mail that bogofilter thinks is spam, forward it to the non-spam
> address. Periodically, log on to the mail server and go to the directory
> where the spam mails are. 'su' as the user 'filter' and do a 'cat * |
> bogofilter -s'. Delete all the spam files. Then go to the directory where
> the good emails are and do a 'cat * | bogofilter -h'. Then delete all the
> good emails. Hopefully, the performance of bogofilter improves over time.
>
> Bogofilter has a bug where the last line is sometimes duplicated using the
> '-p' option.
>
>
>
More information about the Kclug
mailing list