1 |
I've been working on making postfix and bogofilter play together. |
2 |
I think it's working good enough to tell how I did it. I don't have procmail |
3 |
installed, so this is how I use bogofilter without it. This is on a |
4 |
mailserver that handles mail for a small number of users. |
5 |
|
6 |
1. Get postfix installed and running properly. |
7 |
|
8 |
2. Get bogofilter installed and running properly from the command line. |
9 |
|
10 |
3. Create a user, I used 'filter' as a username. This user should not be |
11 |
able to log in, but does need a home directory. I used '/home/filter'. |
12 |
|
13 |
4. Put the bogofilter executable in /usr/sbin |
14 |
|
15 |
5. Put the following script in /usr/sbin |
16 |
|
17 |
#!/bin/bash |
18 |
|
19 |
export PATH=$PATH:/usr/sbin |
20 |
export HOME=/home/filter |
21 |
cd $HOME |
22 |
|
23 |
bogofilter -p | sendmail -i "$@" |
24 |
|
25 |
6. In the master.cf configuration file for postfix, find the line that looks |
26 |
like: |
27 |
|
28 |
smtp inet (some other stuff) smtpd |
29 |
|
30 |
and add this line after it. |
31 |
|
32 |
-o content_filter=filter: |
33 |
|
34 |
Be sure to include the ':' at the end of the line. |
35 |
|
36 |
7. Append these lines to the end of the master.cf file: |
37 |
|
38 |
filter unix - n n - - pipe |
39 |
user=filter argv=/usr/sbin/filtermail -f ${sender} -- ${recipient} |
40 |
|
41 |
8. Do a 'postfix reload'. |
42 |
|
43 |
9. Now, anything bogofilter recognizes as spam will have a header that looks |
44 |
like: |
45 |
|
46 |
X-Spam-Status: Yes, tests=bogofilter |
47 |
|
48 |
and anything it doesn't think is spam will look like: |
49 |
|
50 |
X-Spam-Status: No, tests=bogofilter |
51 |
|
52 |
10. Even though bogofilter is now filtering your email. It doesn't know what |
53 |
to look for to distinguish spam from real email. Create two other mail |
54 |
accounts, one for spam and one for non-spam. Anytime you receive spam that |
55 |
bogofilter doesn't catch, forward it to the spam address. Anytime you |
56 |
receive good mail that bogofilter thinks is spam, forward it to the non-spam |
57 |
address. Periodically, log on to the mail server and go to the directory |
58 |
where the spam mails are. 'su' as the user 'filter' and do a 'cat * | |
59 |
bogofilter -s'. Delete all the spam files. Then go to the directory where |
60 |
the good emails are and do a 'cat * | bogofilter -h'. Then delete all the |
61 |
good emails. Hopefully, the performance of bogofilter improves over time. |
62 |
|
63 |
Bogofilter has a bug where the last line is sometimes duplicated using the |
64 |
'-p' option. |
65 |
|
66 |
Jim Duey |
67 |
Intensive Systems Consulting, LLC |
68 |
Consulting for Embedded Linux and Industrial Controls |
69 |
|
70 |
|
71 |
-- |
72 |
gentoo-dev@g.o mailing list |