Mercurial > dnsbl
annotate xml/dnsbl.in @ 178:d6531c702be3
embedded dcc filtering
author | carl |
---|---|
date | Thu, 04 Oct 2007 22:45:21 -0700 |
parents | 4ec928b24bab |
children | 8b86a894514d |
rev | line source |
---|---|
108 | 1 <reference> |
2 <title>@PACKAGE@ Sendmail milter - Version @VERSION@</title> | |
3 <partintro> | |
4 <title>Packages</title> | |
5 <para>The various source and binary packages are available at <ulink | |
114
f4f5fb263072
cleanup list of tlds, add trailing / on http package directory reference
carl
parents:
111
diff
changeset
|
6 url="http://www.five-ten-sg.com/@PACKAGE@/packages/">http://www.five-ten-sg.com/@PACKAGE@/packages/</ulink> |
108 | 7 The most recent documentation is available at <ulink |
8 url="http://www.five-ten-sg.com/@PACKAGE@/">http://www.five-ten-sg.com/@PACKAGE@/</ulink> | |
9 </para> | |
94 | 10 |
108 | 11 </partintro> |
94 | 12 |
108 | 13 <refentry id="@PACKAGE@.1"> |
14 <refentryinfo> | |
174 | 15 <date>2007-09-07</date> |
108 | 16 </refentryinfo> |
94 | 17 |
108 | 18 <refmeta> |
19 <refentrytitle>@PACKAGE@</refentrytitle> | |
20 <manvolnum>1</manvolnum> | |
21 <refmiscinfo>@PACKAGE@ @VERSION@</refmiscinfo> | |
22 </refmeta> | |
23 | |
24 <refnamediv id='name.1'> | |
25 <refname>@PACKAGE@</refname> | |
26 <refpurpose>a sendmail milter with per-user dnsbl filtering</refpurpose> | |
27 </refnamediv> | |
94 | 28 |
108 | 29 <refsynopsisdiv id='synopsis.1'> |
30 <title>Synopsis</title> | |
31 <cmdsynopsis> | |
32 <command>@PACKAGE@</command> | |
33 <arg><option>-c</option></arg> | |
34 <arg><option>-s</option></arg> | |
35 <arg><option>-d <replaceable class="parameter">n</replaceable></option></arg> | |
36 <arg><option>-e <replaceable class="parameter">from|to</replaceable></option></arg> | |
37 <arg><option>-r <replaceable class="parameter">local-domain-socket</replaceable></option></arg> | |
38 <arg><option>-p <replaceable class="parameter">sendmail-socket</replaceable></option></arg> | |
39 <arg><option>-t <replaceable class="parameter">timeout</replaceable></option></arg> | |
40 </cmdsynopsis> | |
41 </refsynopsisdiv> | |
94 | 42 |
108 | 43 <refsect1 id='options.1'> |
44 <title>Options</title> | |
45 <variablelist> | |
46 <varlistentry> | |
47 <term>-c</term> | |
111 | 48 <listitem><para> |
49 Load the configuration file, print a cannonical form | |
50 of the configuration on stdout, and exit. | |
51 </para></listitem> | |
108 | 52 </varlistentry> |
53 <varlistentry> | |
54 <term>-s</term> | |
111 | 55 <listitem><para> |
56 Stress test the configuration loading code by repeating | |
57 the load/free cycle in an infinite loop. | |
58 </para></listitem> | |
108 | 59 </varlistentry> |
60 <varlistentry> | |
61 <term>-d <replaceable class="parameter">n</replaceable></term> | |
111 | 62 <listitem><para> |
63 Set the debug level to <replaceable class="parameter">n</replaceable>. | |
64 </para></listitem> | |
108 | 65 </varlistentry> |
66 <varlistentry> | |
67 <term>-e <replaceable class="parameter">from|to</replaceable></term> | |
111 | 68 <listitem><para> |
69 Print the results of looking up the from and to addresses in the | |
70 current configuration. The | character is used to separate the from and to | |
71 addresses in the argument to the -e switch. | |
72 </para></listitem> | |
108 | 73 </varlistentry> |
74 <varlistentry> | |
75 <term>-r <replaceable class="parameter">local-domain-socket</replaceable></term> | |
111 | 76 <listitem><para> |
77 Set the local socket used for the connection to our own dns resolver processes. | |
78 </para></listitem> | |
108 | 79 </varlistentry> |
80 <varlistentry> | |
81 <term>-p <replaceable class="parameter">sendmail-socket</replaceable></term> | |
111 | 82 <listitem><para> |
83 Set the socket used for the milter connection to sendmail. This is either | |
84 "inet:port@ip-address" or "local:local-domain-socket-file-name". | |
85 </para></listitem> | |
108 | 86 </varlistentry> |
87 <varlistentry> | |
88 <term>-t <replaceable class="parameter">timeout</replaceable></term> | |
111 | 89 <listitem><para> |
90 Set the timeout in seconds used for communication with sendmail. | |
91 </para></listitem> | |
108 | 92 </varlistentry> |
93 </variablelist> | |
94 </refsect1> | |
94 | 95 |
111 | 96 <refsect1 id='usage.1'> |
108 | 97 <title>Usage</title> |
98 <para><command>@PACKAGE@</command> -c</para> | |
99 <para><command>@PACKAGE@</command> -s</para> | |
111 | 100 <para><command>@PACKAGE@</command> -e 'someone@aol.com|localname@mydomain.tld'</para> |
101 <para><command>@PACKAGE@</command> -d 10 -r resolver.sock -p local:dnsbl.sock</para> | |
102 </refsect1> | |
103 | |
104 <refsect1 id='installation.1'> | |
105 <title>Installation</title> | |
106 <para> | |
107 This is now a standard GNU autoconf/automake installation, so the normal | |
108 "./configure; make; su; make install" works. "make chkconfig" will | |
109 setup the init.d runlevel scripts. Alternatively, you can use the | |
110 source or binary RPMs at <ulink | |
111 url="http://www.five-ten-sg.com/@PACKAGE@/packages">http://www.five-ten-sg.com/@PACKAGE@/packages</ulink>. | |
112 </para> | |
113 <para> | |
114 Note that this has ONLY been tested on Linux, specifically RedHat Linux. | |
115 In particular, this milter makes no attempt to understand IPv6. Your | |
116 mileage will vary. You will need at a minimum a C++ compiler with a | |
117 minimally thread safe STL implementation. The distribution includes a | |
118 test.cpp program. If it fails this milter won't work. If it passes, | |
119 this milter might work. | |
120 </para> | |
121 <para> | |
122 Modify your sendmail.mc by removing all the "FEATURE(dnsbl" lines, add | |
123 the following line in your sendmail.mc and rebuild the .cf file | |
124 </para> | |
125 <para><screen>INPUT_MAIL_FILTER(`dnsbl', `S=local:/var/run/dnsbl/dnsbl.sock, F=T, T=C:30s;S:5m;R:5m;E:5m')</screen></para> | |
126 <para> | |
127 Modify the default <citerefentry> | |
128 <refentrytitle>@PACKAGE@.conf</refentrytitle> <manvolnum>5</manvolnum> | |
129 </citerefentry> configuration. | |
130 </para> | |
131 </refsect1> | |
132 | |
133 <refsect1 id='configuration.1'> | |
134 <title>Configuration</title> | |
135 <para> | |
136 The configuration file is documented in <citerefentry> | |
137 <refentrytitle>@PACKAGE@.conf</refentrytitle> <manvolnum>5</manvolnum> | |
138 </citerefentry>. Any change to the config file, or any file included | |
139 from that config file, will cause it to be reloaded within three | |
140 minutes. | |
141 </para> | |
108 | 142 </refsect1> |
94 | 143 |
108 | 144 <refsect1 id='introduction.1'> |
145 <title>Introduction</title> | |
146 <para> | |
147 Consider the case of a mail server that is acting as secondary MX for a | |
148 collection of clients, each of which has a collection of mail domains. | |
149 Each client may use their own collection of DNSBLs on their primary mail | |
150 server. We present here a mechanism whereby the backup mail server can | |
151 use the correct set of DNSBLs for each recipient for each message. As a | |
152 side-effect, it gives us the ability to customize the set of DNSBLs on a | |
153 per-recipient basis, so that fred@example.com could use SPEWS and the | |
154 SBL, where all other users @example.com use only the SBL. | |
155 </para> | |
156 <para> | |
157 This milter can also verify the envelope from/recipient pairs with the | |
158 primary MX server. This allows the backup mail servers to properly | |
159 reject mail sent to invalid addresses. Otherwise, the backup mail | |
160 servers will accept that mail, and then generate a bounce message when | |
161 the message is forwarded to the primary server (and rejected there with | |
127 | 162 no such user). These rejections are the primary cause of such backscatter. |
108 | 163 </para> |
164 <para> | |
165 This milter will also decode (uuencode, base64, mime, html entity, url | |
166 encodings) and scan for HTTP and HTTPS URLs and bare hostnames in the | |
167 body of the mail. If any of those host names have A or NS records on | |
168 the SBL (or a single configurable DNSBL), the mail will be rejected | |
169 unless previously whitelisted. This milter also counts the number of | |
170 invalid HTML tags, and can reject mail if that count exceeds your | |
171 specified limit. | |
172 </para> | |
173 <para> | |
136 | 174 This milter can also impose hourly rate limits on the number of |
175 recipients accepted from SMTP AUTH connections, that would otherwise be | |
176 allowed to relay thru this mail server with no spam filtering. | |
177 </para> | |
178 <para> | |
162 | 179 Consider the case of a message from A to B passing thru this milter. If |
180 that message is not blocked, then we might eventually see a reply | |
156 | 181 message from B to A. If the filtering context for A includes an |
162 | 182 autowhite entry, and that context does <emphasis>not</emphasis> cover B |
183 as a recipient, then this milter will add an entry in that file to | |
184 whitelist such replies for a configurable time period. Suppose A and B | |
185 are in the same domain, or at least use the same filtering context. In | |
186 that case we don't want to add a whitelist entry for B, since that would | |
187 then allow spammers to send mail from B (forged) to B. Such autowhite | |
160 | 188 files need to be writeable by the dnsbl user, where all the other dnsbl |
189 configuration files only need to be readable by the dnsbl user. | |
156 | 190 </para> |
191 <para> | |
176
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
192 You can manually add such an autowhite entry, by appending a single |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
193 text line to the autowhitelist file, using something like |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
194 <command>echo "$mail 0" >>$autowhitefile</command>. |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
195 You can manually remove such an autowhite entry, by appending a single |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
196 text line to the autowhitelist file, using something like |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
197 <command>echo "$mail 1" >>$autowhitefile</command>. |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
198 </para> |
4ec928b24bab
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
175
diff
changeset
|
199 <para> |
108 | 200 The DNSBL milter reads a text configuration file (dnsbl.conf) on |
201 startup, and whenever the config file (or any of the referenced include | |
202 files) is changed. The entire configuration file is case insensitive. | |
203 If the configuration cannot be loaded due to a syntax error, the milter | |
204 will log the error and quit. If the configuration cannot be reloaded | |
205 after being modified, the milter will log the error and send an email to | |
152 | 206 root from dnsbl@$hostname. You probably want to add dnsbl@$hostname |
108 | 207 to your /etc/mail/virtusertable since otherwise sendmail will reject |
208 that message. | |
209 </para> | |
210 </refsect1> | |
94 | 211 |
111 | 212 <refsect1 id='dcc.1'> |
108 | 213 <title>DCC Issues</title> |
214 <para> | |
215 If you are also using the <ulink | |
216 url="http://www.rhyolite.com/anti-spam/dcc/">DCC</ulink> milter, there | |
217 are a few considerations. You may need to whitelist senders from the | |
218 DCC bulk detector, or from the DNS based lists. Those are two very | |
219 different reasons for whitelisting. The former is done thru the DCC | |
220 whiteclnt config file, the later is done thru the DNSBL milter config | |
221 file. | |
222 </para> | |
223 <para> | |
224 You may want to blacklist some specific senders or sending domains. | |
225 This could be done thru either the DCC (on a global basis, or for a | |
226 specific single recipient). We prefer to do such blacklisting via the | |
227 DNSBL milter config, since it can be done for a collection of recipient | |
228 mail domains. The DCC approach has the feature that you can capture the | |
229 entire message in the DCC log files. The DNSBL milter approach has the | |
230 feature that the mail is rejected earlier (at RCPT TO time), and the | |
231 sending machine just gets a generic "550 5.7.1 no such user" message. | |
232 </para> | |
233 <para> | |
234 The DCC whiteclnt file can be included in the DNSBL milter config by the | |
235 dcc_to and dcc_from statements. This will import the (env_to, env_from, | |
236 and substitute mail_host) entries from the DCC config into the DNSBL | |
237 config. This allows using the DCC config as the single point for | |
238 white/blacklisting. | |
239 </para> | |
240 <para> | |
241 Consider the case where you have multiple clients, each with their own | |
242 mail servers, and each running their own DCC milters. Each client is | |
243 using the DCC facilities for envelope from/to white/blacklisting. | |
244 Presumably you can use rsync or scp to fetch copies of your clients DCC | |
245 whiteclnt files on a regular basis. Your mail server, acting as a | |
246 backup MX for your clients, can use the DNSBL milter, and include those | |
247 client DCC config files. The envelope from/to white/blacklisting will | |
248 be appropriately tagged and used only for the domains controlled by each | |
249 of those clients. | |
250 </para> | |
251 </refsect1> | |
94 | 252 |
111 | 253 <refsect1 id='definitions.1'> |
108 | 254 <title>Definitions</title> |
255 <para> | |
256 CONTEXT - a collection of parameters that defines the filtering context | |
257 to be used for a collection of envelope recipient addresses. The | |
258 context includes such things as the list of DNSBLs to be used, and the | |
259 various content filtering parameters. | |
260 </para> | |
261 <para> | |
262 DNSBL - a named DNS based blocking list is defined by a dns suffix (e.g. | |
263 sbl-xbl.spamhaus.org) and a message string that is used to generate the | |
264 "550 5.7.1" smtp error return code. The names of these DNSBLs will be | |
265 used to define the DNSBL-LISTs. | |
266 </para> | |
267 <para> | |
268 DNSBL-LIST - a named list of DNSBLs that will be used for specific | |
269 recipients or recipient domains. | |
270 </para> | |
271 </refsect1> | |
94 | 272 |
111 | 273 <refsect1 id='filtering.1'> |
108 | 274 <title>Filtering Procedure</title> |
275 <para> | |
152 | 276 The SMTP envelope 'from' and 'to' values are used in various checks. |
277 The first check is to see if a reply message (swapping the env_from and | |
160 | 278 env_to values) would be unconditionally blocked (just based on the |
279 envelope from address). That check is similar to the main check | |
280 described below, but there is no body content to be scanned, and there | |
281 is no client connection ip address to be checked against DNSBLs. If | |
282 such a reply message would be blocked, we also block the original | |
283 outgoing message. This prevents folks from sending mail to recipients | |
284 that are unable to reply. | |
152 | 285 </para> |
286 <para> | |
136 | 287 If the client has authenticated with sendmail, the rate limits are |
288 checked. If the authenticated user has not exceeded the hourly rate | |
144
31ff00ea6bfb
allow parent/child to share a fully qualified env_to address
carl
parents:
140
diff
changeset
|
289 limit, then the mail is accepted, the filtering contexts are not used, |
136 | 290 the dns lists are not checked, and the body content is not scanned. If |
291 the client has not authenticated with sendmail, we follow these steps | |
292 for each recipient. | |
108 | 293 </para> |
294 <orderedlist> | |
111 | 295 <listitem><para> |
108 | 296 The envelope to email address is used to find an initial filtering |
297 context. We first look for a context that specified the full email | |
298 address in the env_to statement. If that is not found, we look for a | |
299 context that specified the entire domain name of the envelope recipient | |
300 in the env_to statement. If that is not found, we look for a context | |
301 that specified the user@ part of the envelope recipient in the env_to | |
302 statement. If that is not found, we use the first top level context | |
303 defined in the config file. | |
111 | 304 </para></listitem> |
305 <listitem><para> | |
108 | 306 The initial filtering context may redirect to a child context based on |
307 the values in the initial context's env_from statement. We look for [1) | |
308 the full envelope from email address, 2) the domain name part of the | |
309 envelope from address, 3) the user@ part of the envelope from address] | |
310 in that context's env_from statement, with values that point to a child | |
311 context. If such an entry is found, we switch to that child filtering | |
312 context. | |
111 | 313 </para></listitem> |
314 <listitem><para> | |
108 | 315 We lookup [1) the full envelope from email address, 2) the domain name |
316 part of the envelope from address, 3) the user@ part of the envelope | |
317 from address] in the filtering context env_from statement. That results | |
318 in one of (white, black, unknown, inherit). | |
111 | 319 </para></listitem> |
320 <listitem><para> | |
108 | 321 If the answer is black, mail to this recipient is rejected with "no such |
322 user", and the dns lists are not checked. | |
111 | 323 </para></listitem> |
324 <listitem><para> | |
108 | 325 If the answer is white, mail to this recipient is accepted and the dns |
326 lists are not checked. | |
111 | 327 </para></listitem> |
328 <listitem><para> | |
108 | 329 If the answer is unknown, we don't reject yet, but the dns lists will be |
330 checked, and the content may be scanned. | |
111 | 331 </para></listitem> |
332 <listitem><para> | |
108 | 333 If the answer is inherit, we repeat the envelope from search in the |
334 parent context. | |
111 | 335 </para></listitem> |
336 <listitem><para> | |
168 | 337 If the mail has not been accepted or rejected yet, the dns lists |
338 specified in the filtering context are checked and the mail is rejected | |
339 if any list has an A record for the standard dns based lookup scheme | |
340 (reversed octets of the client followed by the dns suffix). | |
341 </para></listitem> | |
342 <listitem><para> | |
343 If the mail has not been accepted or rejected yet, and the filtering | |
170 | 344 context (or any ancestor context) specifies a non-empty generic regular |
345 expression, then we check the fully qualified client name (obtained via | |
346 the sendmail macro "_"). The mail is rejected if the client name | |
347 matches the specified regular expression. | |
111 | 348 </para></listitem> |
349 <listitem><para> | |
108 | 350 If the mail has not been accepted or rejected yet, we look for a |
351 verification context, which is the closest ancestor of the filtering | |
352 context that both specifies a verification host, and which covers the | |
353 envelope to address. If we find such a verification context, and the | |
354 verification host is not our own hostname, we open an smtp conversation | |
355 with that verification host. The current envelope from and recipient to | |
356 values are passed to that verification host. If we receive a 5xy | |
357 response those commands, we reject the current recipient with "no such | |
358 user". | |
111 | 359 </para></listitem> |
360 <listitem><para> | |
108 | 361 If the mail has not been accepted or rejected yet, and the filtering |
362 context enables content filtering, and this is the first such recipient | |
363 in this smtp transaction, we set the content filtering parameters from | |
364 this context, and enable content filtering for the body of this message. | |
111 | 365 </para></listitem> |
108 | 366 </orderedlist> |
367 <para> | |
160 | 368 For each recipient that was accepted, we search for an autowhite entry |
369 starting in the reply filtering context. If an autowhite entry is found, | |
370 we add the recipient to that auto whitelist file. This will prevent reply | |
371 messages from being blocked by the dnsbl or content filtering. | |
372 </para> | |
373 <para> | |
108 | 374 If content filtering is enabled for this body, the mail text is decoded |
119 | 375 (uuencode, base64, mime, html entity, url encodings), and scanned for HTTP |
376 and HTTPS URLs or bare host names. Hostnames must be either ip address | |
377 literals, or must end in a string defined by the TLD list. The first | |
378 <configurable> host names are checked as follows. | |
379 </para> | |
380 <para> | |
381 The only known list that is suitable for the content filter DNSBL is the | |
382 SBL. If the content filter DNSBL is defined, and any of those host | |
383 names resolve to ip addresses that are on that DNSBL (or have | |
384 nameservers that are on that list), and the host name is not on the | |
385 <configurable> ignore list, the mail is rejected. | |
386 </para> | |
387 <para> | |
388 If the content uribl DNSBL is defined, and any of those host names are | |
389 on that DNSBL, and the host name is not on the <configurable> | |
390 ignore list, the mail is rejected. | |
391 </para> | |
392 <para> | |
167
9b129ed78d7d
actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents:
164
diff
changeset
|
393 If any non-whitelisted recipient has a filtering context with a non-zero |
9b129ed78d7d
actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents:
164
diff
changeset
|
394 spamassassin limit, then the message is passed thru spamassassin (via |
9b129ed78d7d
actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents:
164
diff
changeset
|
395 spamc), and the message is rejected for those recipients with spamassassin |
9b129ed78d7d
actually use spamassassin result, allow build without spam assassin, only call it if some recipient needs it.
carl
parents:
164
diff
changeset
|
396 limits less than the resulting spamassassin score. |
163 | 397 </para> |
398 <para> | |
119 | 399 We also scan for excessive bad html tags, and if a <configurable> |
400 limit is exceeded, the mail is rejected. | |
108 | 401 </para> |
402 </refsect1> | |
94 | 403 |
111 | 404 <refsect1 id='access.1'> |
108 | 405 <title>Sendmail access vs. DNSBL</title> |
406 <para> | |
407 With the standard sendmail.mc dnsbl FEATURE, the dnsbl checks may be | |
408 suppressed by entries in the /etc/mail/access database. For example, | |
409 suppose you control a /18 of address space, and have allocated some /24s | |
410 to some clients. You have access entries like | |
111 | 411 <literallayout class="monospaced"><![CDATA[ |
412 192.168.4 OK | |
413 192.168.17 OK]]></literallayout> | |
108 | 414 </para> |
415 <para> | |
416 to allow those clients to smarthost thru your mail server. Now if one | |
417 of those clients happens get infected with a virus that turns a machine | |
418 into an open proxy, and their 192.168.4.45 lands on the SBL-XBL, you | |
419 will still wind up allowing that infected machine to smarthost thru your | |
420 mail servers. | |
421 </para> | |
422 <para> | |
423 With this DNSBL milter, the sendmail access database cannot override the | |
424 dnsbl checks, so that machine won't be able to send mail to or thru your | |
425 smarthost mail server (unless the virus/proxy can use smtp-auth). | |
426 </para> | |
427 <para> | |
428 Using the standard sendmail features, you would add access entries to | |
429 allow hosts on your local network to relay thru your mail server. Those | |
430 OK entries in the sendmail access database will override all the dnsbl | |
431 checks. With this DNSBL milter, you will need to have the local users | |
432 authenticate with smtp-auth to get the same effect. You might find | |
433 <ulink | |
434 url="http://www.ists.dartmouth.edu/classroom/sendmail-ssl-how-to.php"> | |
435 these directions</ulink> helpful for setting up smtp-auth if you are on | |
436 RH Linux. | |
437 </para> | |
438 </refsect1> | |
94 | 439 |
111 | 440 <refsect1 id='performance.1'> |
108 | 441 <title>Performance Issues</title> |
442 <para> | |
443 Consider a high volume high performance machine running sendmail. Each | |
444 sendmail process can do its own dns resolution. Typically, such dns | |
445 resolver libraries are not thread safe, and so must be protected by some | |
446 sort of mutex in a threaded environment. When we add a milter to | |
447 sendmail, we now have a collection of sendmail processes, and a | |
448 collection of milter threads. | |
449 </para> | |
450 <para> | |
451 We will be doing a lot of dns lookups per mail message, and at least | |
452 some of those will take many tens of seconds. If all this dns work is | |
453 serialized inside the milter, we have an upper limit of about 25K mail | |
454 messages per day. That is clearly not sufficient for many sites. | |
455 </para> | |
456 <para> | |
457 Since we want to do parallel dns resolution across those milter threads, | |
458 we add another collection of dns resolver processes. Each sendmail | |
459 process is talking to a milter thread over a socket, and each milter | |
460 thread is talking to a dns resolver process over another socket. | |
461 </para> | |
462 <para> | |
463 Suppose we are processing 20 messages per second, and each message | |
464 requires 20 seconds of dns work. Then we will have 400 sendmail | |
465 processes, 400 milter threads, and 400 dns resolver processes. Of | |
466 course that steady state is very unlikely to happen. | |
467 </para> | |
468 </refsect1> | |
94 | 469 |
470 | |
111 | 471 <refsect1 id='rejected.1'> |
108 | 472 <title>Rejected Ideas</title> |
473 <para> | |
474 The following ideas have been considered and rejected. | |
475 </para> | |
476 <para> | |
111 | 477 Add max_recipients setting to the context configuration. Recipients in |
478 excess of that limit will be rejected, and all the non-whitelisted | |
479 recipients will be removed. Current spammers *very* rarely send more | |
480 than ten recipients in a single smtp transaction, so this won't stop any | |
108 | 481 significant amount of spam. |
482 </para> | |
483 <para> | |
484 Add poison addresses to the configuration. If any recipient is | |
485 poison, all recipients are rejected even if they would be whitelisted, | |
486 and the data is rejected if sent. I have a collection of spam trap | |
487 addresses that would be suitable for such use. Based on my log files, | |
488 any mail to those spam trap addresses is rejected based on either dnsbl | |
489 lookups or the DCC. So this won't result in blocking any additional | |
490 spam. | |
491 </para> | |
492 <para> | |
493 Add an option to only allow one recipient if the return path is | |
494 empty. Based on my log files, there is no mail that violates this | |
495 check. | |
496 </para> | |
497 <para> | |
498 Reject the mail if the envelope from domain name contains any MX | |
499 records pointing to 127.0.0.0/8. I don't see any significant amount of | |
500 spam sent with such domain names. | |
501 </para> | |
502 </refsect1> | |
94 | 503 |
108 | 504 <refsect1 id='todo.1'> |
505 <title>TODO</title> | |
506 <para> | |
507 The following ideas are under consideration. | |
508 </para> | |
509 <para> | |
510 Add a per-context option to reject mail if the number of digits in | |
511 the reverse dns client name exceeds some threshold. | |
512 </para> | |
115 | 513 <para> |
514 Look for href="hostname/path" strings that are missing the required | |
515 http:// protocol header. Such references are still clickable in common | |
516 mail software. | |
517 </para> | |
108 | 518 </refsect1> |
94 | 519 |
111 | 520 <refsect1 id='copyright.1'> |
108 | 521 <title>Copyright</title> |
522 <para> | |
163 | 523 Copyright (C) 2007 by 510 Software Group <carl@five-ten-sg.com> |
108 | 524 </para> |
525 <para> | |
526 This program is free software; you can redistribute it and/or modify it | |
527 under the terms of the GNU General Public License as published by the | |
160 | 528 Free Software Foundation; either version 3, or (at your option) any |
108 | 529 later version. |
530 </para> | |
531 <para> | |
532 You should have received a copy of the GNU General Public License along | |
533 with this program; see the file COPYING. If not, please write to the | |
534 Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
535 </para> | |
536 </refsect1> | |
94 | 537 |
111 | 538 <refsect1 id='version.1'> |
539 <title>CVS Version</title> | |
108 | 540 <para> |
541 $Id$ | |
542 </para> | |
543 </refsect1> | |
544 </refentry> | |
545 | |
546 | |
547 <refentry id="@PACKAGE@.conf.5"> | |
548 <refentryinfo> | |
174 | 549 <date>2007-09-07</date> |
108 | 550 </refentryinfo> |
94 | 551 |
108 | 552 <refmeta> |
553 <refentrytitle>@PACKAGE@.conf</refentrytitle> | |
554 <manvolnum>5</manvolnum> | |
555 <refmiscinfo>@PACKAGE@ @VERSION@</refmiscinfo> | |
556 </refmeta> | |
94 | 557 |
108 | 558 <refnamediv id='name.5'> |
559 <refname>@PACKAGE@.conf</refname> | |
111 | 560 <refpurpose>configuration file for @PACKAGE@ sendmail milter</refpurpose> |
108 | 561 </refnamediv> |
562 | |
563 <refsynopsisdiv id='synopsis.5'> | |
564 <title>Synopsis</title> | |
565 <cmdsynopsis> | |
566 <command>@PACKAGE@.conf</command> | |
567 </cmdsynopsis> | |
568 </refsynopsisdiv> | |
94 | 569 |
108 | 570 <refsect1 id='description.5'> |
571 <title>Description</title> | |
572 <para>The <command>@PACKAGE@.conf</command> configuration file is | |
148
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
573 specified by this partial bnf description. Comments start with // |
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
574 or # and extend to the end of the line. To include the contents |
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
575 of some file verbatim in the dnsbl.conf file, use |
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
576 <literallayout class="monospaced"><![CDATA[include "<file>";]]></literallayout> |
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
577 </para> |
108 | 578 |
579 <literallayout class="monospaced"><![CDATA[ | |
580 CONFIG = {CONTEXT ";"}+ | |
581 CONTEXT = "context" NAME "{" {STATEMENT}+ "}" | |
168 | 582 STATEMENT = (DNSBL | DNSBLLIST | CONTENT | ENV-TO | VERIFY | GENERIC |
583 | AUTOWHITE | CONTEXT | ENV-FROM | RATE-LIMIT) ";" | |
108 | 584 |
124 | 585 DNSBL = "dnsbl" NAME DNSPREFIX ERROR-MSG1 |
108 | 586 |
587 DNSBLLIST = "dnsbl_list" {NAME}+ | |
94 | 588 |
108 | 589 CONTENT = "content" ("on" | "off") "{" {CONTENT-ST}+ "}" |
178 | 590 CONTENT-ST = (FILTER | URIBL | IGNORE | TLD | CCTLD | HTML-TAGS | |
591 HTML-LIMIT | HOST-LIMIT | SPAMASS | REQUIRE | DCCGREY | | |
592 DCCBULK) ";" | |
124 | 593 FILTER = "filter" DNSPREFIX ERROR-MSG2 |
594 URIBL = "uribl" DNSPREFIX ERROR-MSG3 | |
108 | 595 IGNORE = "ignore" "{" {HOSTNAME [";"]}+ "}" |
596 TLD = "tld" "{" {TLD [";"]}+ "}" | |
119 | 597 CCTLD = "cctld" "{" {TLD [";"]}+ "}" |
108 | 598 HTML-TAGS = "html_tags" "{" {HTMLTAG [";"]}+ "}" |
124 | 599 ERROR-MSG1 = string containing exactly two %s replacement tokens |
600 both are replaced with the client ip address | |
601 ERROR-MSG2 = string containing exactly two %s replacement tokens | |
602 the first is replaced with the hostname, and the second | |
603 is replaced with the ip address | |
604 ERROR-MSG3 = string containing exactly two %s replacement tokens | |
605 both are replaced with the hostname | |
108 | 606 |
607 HTML-LIMIT = "html_limit" ("on" INTEGER ERROR-MSG | "off") | |
608 | |
111 | 609 HOST-LIMIT = "host_limit" ("on" INTEGER ERROR-MSG | "off" | |
610 "soft" INTEGER) | |
178 | 611 SPAMASS = "spamassassin" INTEGER |
612 REQUIRE = "require_match" ("yes" | "no") | |
613 DCCGREY = "dcc_greylist" ("yes" | "no") | |
614 DCCBULK = "dcc_bulk_threshold" (INTEGER | "many" | "off") | |
94 | 615 |
108 | 616 ENV-TO = "env_to" "{" {(TO-ADDR | DCC-TO)}+ "}" |
617 TO-ADDR = ADDRESS [";"] | |
618 DCC-TO = "dcc_to" ("ok" | "many") "{" DCCINCLUDEFILE "}" ";" | |
619 | |
620 VERIFY = "verify" HOSTNAME ";" | |
168 | 621 GENERIC = "generic" REGULAREXPRESSION ERROR-MSG4 ";" |
622 ERROR-MSG4 = string containing exactly one %s replacement token | |
623 which is replaced with the client name | |
153 | 624 AUTOWHITE = "autowhite" DAYS FILENAME ";" |
108 | 625 |
626 ENV_FROM = "env_from" [DEFAULT] "{" {(FROM-ADDR | DCC-FROM)}+ "}" | |
627 FROM-ADDR = ADDRESS VALUE [";"] | |
628 DCC-FROM = "dcc_from" "{" DCCINCLUDEFILE "}" ";" | |
136 | 629 |
140 | 630 RATE-LIMIT = "rate_limit" [DEFAULTLIMIT] "{" (RATE)+ "}" |
136 | 631 RATE = USER LIMIT [";"] |
632 | |
108 | 633 DEFAULT = ("white" | "black" | "unknown" | "inherit" | "") |
634 ADDRESS = (USER@ | DOMAIN | USER@DOMAIN) | |
148
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
635 VALUE = ("white" | "black" | "unknown" | "inherit" | CHILD-CONTEXT-NAME)]]></literallayout> |
108 | 636 </refsect1> |
94 | 637 |
108 | 638 <refsect1 id='sample.5'> |
639 <title>Sample</title> | |
640 <literallayout class="monospaced"><![CDATA[ | |
127 | 641 context main-default { |
642 // outbound dnsbl filtering to catch our own customers that end up on the sbl | |
643 dnsbl sbl sbl-xbl.spamhaus.org "Mail from %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
174 | 644 dnsbl_list sbl; |
127 | 645 |
646 // outbound content filtering to prevent our own customers from sending spam | |
647 content on { | |
648 filter sbl-xbl.spamhaus.org "Mail containing %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
649 uribl multi.surbl.org "Mail containing %s rejected - surbl; see http://www.rulesemporium.com/cgi-bin/uribl.cgi?bl0=1&domain0=%s"; | |
650 #uribl black.uribl.com "Mail containing %s rejected - uribl; see http://l.uribl.com/?d=%s"; | |
651 ignore { include "hosts-ignore.conf"; }; | |
652 tld { include "tld.conf"; }; | |
653 cctld { include "cctld.conf"; }; | |
654 html_tags { include "html-tags.conf"; }; | |
655 html_limit on 20 "Mail containing excessive bad html tags rejected"; | |
656 html_limit off; | |
657 host_limit on 20 "Mail containing excessive host names rejected"; | |
658 host_limit soft 20; | |
178 | 659 spamassassin 4; |
660 require_match yes; | |
661 dcc_greylist yes; | |
662 dcc_bulk_threshold 50; | |
127 | 663 }; |
664 | |
665 // backscatter prevention - don't send bounces for mail that we accepted but could not forward | |
666 // we only send bounces to our own customers | |
667 env_from unknown { | |
668 "<>" black; | |
669 }; | |
136 | 670 |
144
31ff00ea6bfb
allow parent/child to share a fully qualified env_to address
carl
parents:
140
diff
changeset
|
671 // hourly recipient rate limit by smtp auth client id |
140 | 672 rate_limit 30 { // default |
171 | 673 #fred 100; // override default limits |
674 #joe 10; // "" | |
136 | 675 }; |
127 | 676 }; |
677 | |
171 | 678 context main { |
679 dnsbl localp partial.blackholes.five-ten-sg.com "Mail from %s rejected - local; see http://www.five-ten-sg.com/blackhole.php?%s"; | |
108 | 680 dnsbl local blackholes.five-ten-sg.com "Mail from %s rejected - local; see http://www.five-ten-sg.com/blackhole.php?%s"; |
174 | 681 dnsbl sbl zen.spamhaus.org "Mail from %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; |
108 | 682 dnsbl xbl xbl.spamhaus.org "Mail from %s rejected - xbl; see http://www.spamhaus.org/query/bl?ip=%s"; |
171 | 683 dnsbl_list local sbl; |
94 | 684 |
108 | 685 content on { |
686 filter sbl-xbl.spamhaus.org "Mail containing %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
122 | 687 uribl multi.surbl.org "Mail containing %s rejected - surbl; see http://www.rulesemporium.com/cgi-bin/uribl.cgi?bl0=1&domain0=%s"; |
119 | 688 #uribl black.uribl.com "Mail containing %s rejected - uribl; see http://l.uribl.com/?d=%s"; |
108 | 689 ignore { include "hosts-ignore.conf"; }; |
690 tld { include "tld.conf"; }; | |
119 | 691 cctld { include "cctld.conf"; }; |
108 | 692 html_tags { include "html-tags.conf"; }; |
693 html_limit off; | |
694 host_limit soft 20; | |
178 | 695 spamassassin 5; |
696 require_match yes; | |
697 dcc_greylist yes; | |
698 dcc_bulk_threshold 20; | |
108 | 699 }; |
94 | 700 |
175
e726e1a61ef9
allow manual whitelisting with stamp 1 to remove a whitelist entry
carl
parents:
174
diff
changeset
|
701 generic "(^|[.-])(ppp|h|host)?([0-9]{1,3}[.-](Red-|dynamic[.-])?){4}" |
171 | 702 "your mail server %s seems to have a generic name"; |
703 | |
108 | 704 env_to { |
171 | 705 # !! replace this with your domain names |
108 | 706 # child contexts are not allowed to specify recipient addresses outside these domains |
174 | 707 include "/etc/mail/local-host-names"; |
108 | 708 }; |
94 | 709 |
108 | 710 context whitelist { |
711 content off {}; | |
712 env_to { | |
171 | 713 # dcc_to ok { include "/var/dcc/whitecommon"; }; |
108 | 714 }; |
715 env_from white {}; # white forces all unmatched from addresses (everyone in this case) to be whitelisted | |
716 # so all mail TO these env_to addresses is accepted | |
717 }; | |
94 | 718 |
171 | 719 context abuse { |
720 dnsbl_list xbl; | |
721 content off {}; | |
174 | 722 generic "^$ " " "; # regex cannot match, to disable generic rdns rejects |
171 | 723 env_to { |
724 abuse@ # no content filtering on abuse reports | |
725 postmaster@ # "" | |
726 }; | |
727 env_from unknown {}; # ignore all parent white/black listing | |
728 }; | |
729 | |
108 | 730 context minimal { |
171 | 731 dnsbl_list sbl; |
178 | 732 content on { |
733 spamassassin 10; | |
734 dcc_bulk_threshold many; | |
735 }; | |
171 | 736 generic "^$ " " "; # regex cannot match, to disable generic rdns rejects |
108 | 737 env_to { |
738 }; | |
739 }; | |
94 | 740 |
108 | 741 context blacklist { |
742 env_to { | |
171 | 743 # dcc_to many { include "/var/dcc/whitecommon"; }; |
108 | 744 }; |
745 env_from black {}; # black forces all unmatched from addresses (everyone in this case) to be blacklisted | |
746 # so all mail TO these env_to addresses is rejected | |
747 }; | |
94 | 748 |
171 | 749 env_from unknown { |
750 abuse@ abuse; # replies to abuse reports use the abuse context | |
751 # dcc_from { include "/var/dcc/whitecommon"; }; | |
108 | 752 }; |
753 | |
171 | 754 autowhite 90 "autowhite/my-auto-whitelist"; |
755 # install should create /etc/dnsbl/autowhite writable by userid dnsbl | |
108 | 756 };]]></literallayout> |
757 </refsect1> | |
94 | 758 |
111 | 759 <refsect1 id='version.5'> |
760 <title>CVS Version</title> | |
108 | 761 <para> |
762 $Id$ | |
763 </para> | |
764 </refsect1> | |
765 | |
766 </refentry> | |
767 </reference> |