0
|
1 <html>
|
|
2
|
|
3 <head>
|
|
4 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|
5 <title>DNSBL Sendmail milter</title>
|
|
6 </head>
|
|
7
|
|
8 <p>This milter is released under the GPL license version 2 included in
|
|
9 the LICENSE file in the distribution, and also available at
|
|
10 <a href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</a>
|
|
11
|
|
12 <p>Consider the case of a mail server that is acting as secondary MX
|
|
13 for a collection of clients, each of which has a collection of mail
|
|
14 domains. Each client may use their own collection of DNSBLs on their
|
|
15 primary mail server. We present here a mechanism whereby the backup
|
|
16 mail server can use the correct set of DNSBLs for each message. As a
|
|
17 side-effect, it gives us the ability to customize the set of DNSBLs on a
|
|
18 per-recipient basis, so that fred@example.com could use SPEWS and the
|
|
19 SBL, where all other users @example.com use only the SBL.
|
|
20
|
11
|
21 <p>This milter will also decode (base64, mime, html entity) and scan
|
|
22 for HTTP URLs in the body of the mail. If any of those host names
|
|
23 have A records on the SBL (or a single configurable list), the mail
|
|
24 will be rejected unless previously whitelisted.
|
|
25
|
6
|
26 <p>The DNSBL milter reads a text configuration file (dnsbl.conf) on
|
|
27 startup, and whenever the config file (or any of the referenced include
|
|
28 files) is changed. The entire configuration file is case insensitive.
|
0
|
29
|
|
30 <p>If you are also using the <a
|
|
31 href="http://www.rhyolite.com/anti-spam/dcc/">DCC</a> milter, there are
|
|
32 a few considerations. You may need to whitelist senders from the DCC
|
|
33 bulk detector, or from the DNS based lists. Those are two very
|
|
34 different reasons for whitelisting. The former is done thru the DCC
|
|
35 whiteclnt config file, the later is done thru the DNSBL milter config
|
5
|
36 file.
|
0
|
37
|
|
38 <p>You may want to blacklist some specific senders or sending domains.
|
|
39 This could be done thru either the DCC (on a global basis, or for a
|
|
40 specific single recipient). We prefer to do such blacklisting via the
|
|
41 DNSBL milter config, since it can be done for an entire recipient mail
|
|
42 domain. The DCC approach has the feature that you can capture the
|
|
43 entire message in the DCC log files. The DNSBL milter approach has the
|
|
44 feature that the mail is rejected earlier (at RCPT TO time), and the
|
|
45 sending machine just gets a generic "550 5.7.1 no such user" message.
|
|
46
|
5
|
47 <p>There is an option to reference the DCC whiteclnt file (via an
|
|
48 include_dcc line) in the DNSBL milter config. This will import the
|
|
49 (env_to, env_from, and substitute mail_host) entries from the DCC config
|
|
50 into the DNSBL config. This allows using the DCC config as the single
|
|
51 point for white/blacklisting.
|
|
52
|
|
53 <p>Consider the case where you have multiple clients, each with their
|
|
54 own mail servers, and each running their own DCC milters. Each client
|
|
55 is using the DCC facilities for envelope from/to white/blacklisting.
|
6
|
56 Presumably you can use rsync or scp to fetch copies of your clients DCC
|
5
|
57 whiteclnt files on a regular basis. Your mail server, acting as a
|
|
58 backup MX for your clients, can use the DNSBL milter, and include those
|
|
59 client DCC config files. The envelope to white/blacklisting will be
|
|
60 global for your system, but the envelope from white/blacklisting will be
|
|
61 appropriately tagged and used only for the domains controlled by each of
|
|
62 those clients.
|
|
63
|
0
|
64 <p>Definitions:
|
|
65
|
|
66 <p>DNSBL - a named DNS based blocking list is defined by a dns suffix
|
|
67 (e.g. sbl-xbl.spamhaus.org) and a message string that is used to
|
|
68 generate the "550 5.7.1" smtp error return code. The names of these
|
|
69 DNSBLs will be used to define the DNSBL-LISTs.
|
|
70
|
|
71 <p>DNSBL-LIST - a named list of DNSBLs that will be used for specific
|
|
72 recipients or recipient domains.
|
|
73
|
|
74 <p>ENVELOPE-FROM-MAP - a named collection of mappings (key->value pairs)
|
|
75 from envelope-from values to the WHITE, BLACK, or DEFAULT keywords. The
|
|
76 names of these maps will be used for specific recipients or recipient
|
|
77 domains.
|
|
78
|
|
79 <p>The configuration file maps each recipient (or recipient domain) to
|
|
80 two names (a named DNSBL-LIST, and a named ENVELOPE-FROM-MAP). If the
|
|
81 recipient is not found in the configuration, the named DEFAULT
|
|
82 dnsbl-list and DEFAULT envelope-from-map will be used. When mail is
|
|
83 received for that recipient,
|
|
84
|
|
85 <ol>
|
|
86
|
|
87 <li>If the client has authenticated with sendmail, the mail is accepted
|
|
88 and the dns lists are not checked.
|
|
89
|
|
90 <li>If either one is BLACK, mail to this recipient is rejected with "no
|
|
91 such user", and the dns lists are not checked.
|
|
92
|
|
93 <li>If the envelope-from-map name is WHITE, mail to this recipient is
|
|
94 accepted and the dns lists are not checked.
|
|
95
|
|
96 <li>If the envelope-from-map exists, the map is checked for the presence
|
|
97 of the sender. A WHITE or BLACK answer is definitive and the dns lists
|
|
98 are not checked.
|
|
99
|
|
100 <li>If the dnsbl-list name is WHITE, the dns lists are not checked and
|
|
101 the mail is accepted. Otherwise, the dns lists are checked and the mail
|
|
102 is rejected if any list has an A record for the standard dns based
|
|
103 lookup scheme (reversed octets of the client followed by the dns
|
|
104 suffix).
|
|
105
|
11
|
106 <li>If the mail has not been accepted or rejected yet, the body content
|
|
107 is scanned for HTTP URLs (after base64, mime and html entity decoding),
|
|
108 and the first 20 host names are checked for their presence on the SBL.
|
|
109 If any host name is on the SBL, the mail is rejected.
|
|
110
|
0
|
111 </ol>
|
|
112
|
|
113
|
|
114 <p>Usage: Note that this has ONLY been tested on Linux, specifically
|
|
115 RedHat Linux. Your mileage will vary. In particular, this milter makes no
|
|
116 attempt to understand IPv6.
|
|
117
|
|
118 Fetch <a href="http://www.five-ten-sg.com/util/dnsbl.tar.gz">dnsbl.tar.gz</a>
|
|
119 and
|
|
120
|
|
121 <pre>
|
|
122 tar xfvz dnsbl.tar.gz
|
|
123 bash install.bash
|
|
124 </pre>
|
|
125
|
|
126 Read and understand the contents of that install.bash script before you
|
|
127 run it. It may not be suitable for your system. Modify your
|
|
128 sendmail.mc by removing all the "FEATURE(dnsbl" lines, add the following
|
|
129 line in your sendmail.mc and rebuild the .cf file
|
|
130
|
|
131 <pre>
|
11
|
132 INPUT_MAIL_FILTER(`dnsbl', `S=local:/var/run/dnsbl/dnsbl.sock, F=T, T=C:30s;S:2m;R:2m;E:5m')
|
0
|
133 </pre>
|
|
134
|
|
135 Read the sample <a
|
|
136 href="http://www.five-ten-sg.com/dnsbl.conf">var/dnsbl/dnsbl.conf</a>
|
6
|
137 file and modify it to fit your configuration. You can test your
|
|
138 configuration files, and see a readable internal dump of them on stderr
|
|
139 with
|
|
140
|
|
141 <pre>
|
|
142 cd /var/dnsbl
|
|
143 ./dnsbl -c
|
|
144 </pre>
|
|
145
|
|
146 <pre>
|
0
|
147
|
|
148
|
6
|
149
|
2
|
150 $Id$
|
4
|
151 </pre>
|
0
|
152 </body>
|
|
153 </html>
|