docs: typo
[exim.git] / configs / config.samples / F002
CommitLineData
e0f3765a
PH
1Date: Tue, 03 Mar 1998 15:45:24 -0500
2From: Dan Birchall <djb@16straight.com>
3
4History:
5
6In early 1997, I wrote a little PERL program which refused
7mail from unknown addresses until they mailed me promising
8not to spam me. (This ran on my account as an end-user
9solution.) It was very effective, but didn't scale well.
10
11Recently, I'd been thinking of adding some similar
12functionality to my Exim filter file. Someone on another
13list mentioned that they were going to work on doing the
14same in their Sendmail config, and since I'd already
15thought through how to do it in Exim, and knew it'd be
16slightly easier than falling out of bed, I went ahead and
17did it. I mentioned having done it, and Piete bugged me
18to send it here too. :)
19
20Structure:
21
22There are two (optionally three) flat files involved, plus
23a system-wide filter file and one (optionally two) shell
24script(s).
25
26The first flat file contains a list of recipient e-mail
27addresses handled by my server, with parameters stating
28whether they do or do not wish to be afforded some degree
29of protection from spam through various filters. An
30excerpt:
31
32djb@16straight.com: spam=no
33djb@mule.16straight.com: spam=no untrusted=no
34djb@scream.org: spam=no relay=no untrusted=no
35
36Various filters in my filter file read this, and based
37on the values of certain parameters, will take certain
38measures to prevent spam from reaching an address. This
39particular filter works on the "untrusted" parameter.
40
41The second flat file contains a list of IP addresses for
42hosts that the server has been instructed to trust. (At
43this point, this is a system-wide list; if a host is
44trusted, it's trusted for all addresses. It should be
45fairly similar to arrange for some sort of user-specific
46list, but I haven't had the need.) An excerpt:
47
48206.214.98.16: good=yes
49205.180.57.68: good=yes
50204.249.49.75: good=yes
51
52The filter is as follows:
53
54if
55${lookup{$recipients:untrusted}lsearch{/usr/exim/lists/shield}{$value}}
56is "no"
57and
58${lookup{$sender_host_address:good}lsearch{/usr/exim/lists/good_hosts}{$value}}
59is ""
60then freeze endif
61
62Basically, if $recipients is found in the first file, with
63an "untrusted=no" parameter, and the sending host's IP
64address is *not* in the second file, or does not have a
65"good=yes" parameter next to it, the message is frozen.
66
67I then come along as root and run this script, with the
68Exim message ID as the only argument:
69
70echo -n `grep host_address /usr/exim/spool/input/$1-H |cut -f2 -d" "` >>
71/usr/exim/lists/good_hosts
72echo ": good=yes" >> /usr/exim/lists/good_hosts
73sendmail -M $1
74
75This adds the sending host's IP to the good_hosts file and
76forces delivery of the message.
77
78Options:
79
80The other optional file is a blacklist; the other optional
81script puts the sending host's IP in *that* file and deletes
82the message.
83
84This is just yet another fun little way to play with spam.
85(Looks like meat, tastes like play-doh... or is it the
86other way around?)
87
88Bugs:
89
90Yes, there are weaknesses. Specifically:
91
92* multi-address $recipients will probably get by this
93* scalability is always a concern
94* large ISP's that generate lots of mail _and_ spam...
95
96This is near the top of my filter file, though, and
97there are several other filters below it to catch any
98stuff it might miss.