Mercurial > dnsbl
annotate xml/dnsbl.in @ 162:c4bce911c276 stable-6-03
don't add auto whitelist for A to A
author | carl |
---|---|
date | Sat, 14 Jul 2007 12:25:17 -0700 |
parents | d384df37491f |
children | 97d7da45fe2a |
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> | |
161 | 15 <date>2007-07-10</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> | |
108 | 192 The DNSBL milter reads a text configuration file (dnsbl.conf) on |
193 startup, and whenever the config file (or any of the referenced include | |
194 files) is changed. The entire configuration file is case insensitive. | |
195 If the configuration cannot be loaded due to a syntax error, the milter | |
196 will log the error and quit. If the configuration cannot be reloaded | |
197 after being modified, the milter will log the error and send an email to | |
152 | 198 root from dnsbl@$hostname. You probably want to add dnsbl@$hostname |
108 | 199 to your /etc/mail/virtusertable since otherwise sendmail will reject |
200 that message. | |
201 </para> | |
202 </refsect1> | |
94 | 203 |
111 | 204 <refsect1 id='dcc.1'> |
108 | 205 <title>DCC Issues</title> |
206 <para> | |
207 If you are also using the <ulink | |
208 url="http://www.rhyolite.com/anti-spam/dcc/">DCC</ulink> milter, there | |
209 are a few considerations. You may need to whitelist senders from the | |
210 DCC bulk detector, or from the DNS based lists. Those are two very | |
211 different reasons for whitelisting. The former is done thru the DCC | |
212 whiteclnt config file, the later is done thru the DNSBL milter config | |
213 file. | |
214 </para> | |
215 <para> | |
216 You may want to blacklist some specific senders or sending domains. | |
217 This could be done thru either the DCC (on a global basis, or for a | |
218 specific single recipient). We prefer to do such blacklisting via the | |
219 DNSBL milter config, since it can be done for a collection of recipient | |
220 mail domains. The DCC approach has the feature that you can capture the | |
221 entire message in the DCC log files. The DNSBL milter approach has the | |
222 feature that the mail is rejected earlier (at RCPT TO time), and the | |
223 sending machine just gets a generic "550 5.7.1 no such user" message. | |
224 </para> | |
225 <para> | |
226 The DCC whiteclnt file can be included in the DNSBL milter config by the | |
227 dcc_to and dcc_from statements. This will import the (env_to, env_from, | |
228 and substitute mail_host) entries from the DCC config into the DNSBL | |
229 config. This allows using the DCC config as the single point for | |
230 white/blacklisting. | |
231 </para> | |
232 <para> | |
233 Consider the case where you have multiple clients, each with their own | |
234 mail servers, and each running their own DCC milters. Each client is | |
235 using the DCC facilities for envelope from/to white/blacklisting. | |
236 Presumably you can use rsync or scp to fetch copies of your clients DCC | |
237 whiteclnt files on a regular basis. Your mail server, acting as a | |
238 backup MX for your clients, can use the DNSBL milter, and include those | |
239 client DCC config files. The envelope from/to white/blacklisting will | |
240 be appropriately tagged and used only for the domains controlled by each | |
241 of those clients. | |
242 </para> | |
243 </refsect1> | |
94 | 244 |
111 | 245 <refsect1 id='definitions.1'> |
108 | 246 <title>Definitions</title> |
247 <para> | |
248 CONTEXT - a collection of parameters that defines the filtering context | |
249 to be used for a collection of envelope recipient addresses. The | |
250 context includes such things as the list of DNSBLs to be used, and the | |
251 various content filtering parameters. | |
252 </para> | |
253 <para> | |
254 DNSBL - a named DNS based blocking list is defined by a dns suffix (e.g. | |
255 sbl-xbl.spamhaus.org) and a message string that is used to generate the | |
256 "550 5.7.1" smtp error return code. The names of these DNSBLs will be | |
257 used to define the DNSBL-LISTs. | |
258 </para> | |
259 <para> | |
260 DNSBL-LIST - a named list of DNSBLs that will be used for specific | |
261 recipients or recipient domains. | |
262 </para> | |
263 </refsect1> | |
94 | 264 |
111 | 265 <refsect1 id='filtering.1'> |
108 | 266 <title>Filtering Procedure</title> |
267 <para> | |
152 | 268 The SMTP envelope 'from' and 'to' values are used in various checks. |
269 The first check is to see if a reply message (swapping the env_from and | |
160 | 270 env_to values) would be unconditionally blocked (just based on the |
271 envelope from address). That check is similar to the main check | |
272 described below, but there is no body content to be scanned, and there | |
273 is no client connection ip address to be checked against DNSBLs. If | |
274 such a reply message would be blocked, we also block the original | |
275 outgoing message. This prevents folks from sending mail to recipients | |
276 that are unable to reply. | |
152 | 277 </para> |
278 <para> | |
136 | 279 If the client has authenticated with sendmail, the rate limits are |
280 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
|
281 limit, then the mail is accepted, the filtering contexts are not used, |
136 | 282 the dns lists are not checked, and the body content is not scanned. If |
283 the client has not authenticated with sendmail, we follow these steps | |
284 for each recipient. | |
108 | 285 </para> |
286 <orderedlist> | |
111 | 287 <listitem><para> |
108 | 288 The envelope to email address is used to find an initial filtering |
289 context. We first look for a context that specified the full email | |
290 address in the env_to statement. If that is not found, we look for a | |
291 context that specified the entire domain name of the envelope recipient | |
292 in the env_to statement. If that is not found, we look for a context | |
293 that specified the user@ part of the envelope recipient in the env_to | |
294 statement. If that is not found, we use the first top level context | |
295 defined in the config file. | |
111 | 296 </para></listitem> |
297 <listitem><para> | |
108 | 298 The initial filtering context may redirect to a child context based on |
299 the values in the initial context's env_from statement. We look for [1) | |
300 the full envelope from email address, 2) the domain name part of the | |
301 envelope from address, 3) the user@ part of the envelope from address] | |
302 in that context's env_from statement, with values that point to a child | |
303 context. If such an entry is found, we switch to that child filtering | |
304 context. | |
111 | 305 </para></listitem> |
306 <listitem><para> | |
108 | 307 We lookup [1) the full envelope from email address, 2) the domain name |
308 part of the envelope from address, 3) the user@ part of the envelope | |
309 from address] in the filtering context env_from statement. That results | |
310 in one of (white, black, unknown, inherit). | |
111 | 311 </para></listitem> |
312 <listitem><para> | |
108 | 313 If the answer is black, mail to this recipient is rejected with "no such |
314 user", and the dns lists are not checked. | |
111 | 315 </para></listitem> |
316 <listitem><para> | |
108 | 317 If the answer is white, mail to this recipient is accepted and the dns |
318 lists are not checked. | |
111 | 319 </para></listitem> |
320 <listitem><para> | |
108 | 321 If the answer is unknown, we don't reject yet, but the dns lists will be |
322 checked, and the content may be scanned. | |
111 | 323 </para></listitem> |
324 <listitem><para> | |
108 | 325 If the answer is inherit, we repeat the envelope from search in the |
326 parent context. | |
111 | 327 </para></listitem> |
328 <listitem><para> | |
108 | 329 The dns lists specified in the filtering context are checked and the |
330 mail is rejected if any list has an A record for the standard dns based | |
331 lookup scheme (reversed octets of the client followed by the dns | |
332 suffix). | |
111 | 333 </para></listitem> |
334 <listitem><para> | |
108 | 335 If the mail has not been accepted or rejected yet, we look for a |
336 verification context, which is the closest ancestor of the filtering | |
337 context that both specifies a verification host, and which covers the | |
338 envelope to address. If we find such a verification context, and the | |
339 verification host is not our own hostname, we open an smtp conversation | |
340 with that verification host. The current envelope from and recipient to | |
341 values are passed to that verification host. If we receive a 5xy | |
342 response those commands, we reject the current recipient with "no such | |
343 user". | |
111 | 344 </para></listitem> |
345 <listitem><para> | |
108 | 346 If the mail has not been accepted or rejected yet, and the filtering |
347 context enables content filtering, and this is the first such recipient | |
348 in this smtp transaction, we set the content filtering parameters from | |
349 this context, and enable content filtering for the body of this message. | |
111 | 350 </para></listitem> |
108 | 351 </orderedlist> |
352 <para> | |
160 | 353 For each recipient that was accepted, we search for an autowhite entry |
354 starting in the reply filtering context. If an autowhite entry is found, | |
355 we add the recipient to that auto whitelist file. This will prevent reply | |
356 messages from being blocked by the dnsbl or content filtering. | |
357 </para> | |
358 <para> | |
108 | 359 If content filtering is enabled for this body, the mail text is decoded |
119 | 360 (uuencode, base64, mime, html entity, url encodings), and scanned for HTTP |
361 and HTTPS URLs or bare host names. Hostnames must be either ip address | |
362 literals, or must end in a string defined by the TLD list. The first | |
363 <configurable> host names are checked as follows. | |
364 </para> | |
365 <para> | |
366 The only known list that is suitable for the content filter DNSBL is the | |
367 SBL. If the content filter DNSBL is defined, and any of those host | |
368 names resolve to ip addresses that are on that DNSBL (or have | |
369 nameservers that are on that list), and the host name is not on the | |
370 <configurable> ignore list, the mail is rejected. | |
371 </para> | |
372 <para> | |
373 If the content uribl DNSBL is defined, and any of those host names are | |
374 on that DNSBL, and the host name is not on the <configurable> | |
375 ignore list, the mail is rejected. | |
376 </para> | |
377 <para> | |
378 We also scan for excessive bad html tags, and if a <configurable> | |
379 limit is exceeded, the mail is rejected. | |
108 | 380 </para> |
381 </refsect1> | |
94 | 382 |
111 | 383 <refsect1 id='access.1'> |
108 | 384 <title>Sendmail access vs. DNSBL</title> |
385 <para> | |
386 With the standard sendmail.mc dnsbl FEATURE, the dnsbl checks may be | |
387 suppressed by entries in the /etc/mail/access database. For example, | |
388 suppose you control a /18 of address space, and have allocated some /24s | |
389 to some clients. You have access entries like | |
111 | 390 <literallayout class="monospaced"><![CDATA[ |
391 192.168.4 OK | |
392 192.168.17 OK]]></literallayout> | |
108 | 393 </para> |
394 <para> | |
395 to allow those clients to smarthost thru your mail server. Now if one | |
396 of those clients happens get infected with a virus that turns a machine | |
397 into an open proxy, and their 192.168.4.45 lands on the SBL-XBL, you | |
398 will still wind up allowing that infected machine to smarthost thru your | |
399 mail servers. | |
400 </para> | |
401 <para> | |
402 With this DNSBL milter, the sendmail access database cannot override the | |
403 dnsbl checks, so that machine won't be able to send mail to or thru your | |
404 smarthost mail server (unless the virus/proxy can use smtp-auth). | |
405 </para> | |
406 <para> | |
407 Using the standard sendmail features, you would add access entries to | |
408 allow hosts on your local network to relay thru your mail server. Those | |
409 OK entries in the sendmail access database will override all the dnsbl | |
410 checks. With this DNSBL milter, you will need to have the local users | |
411 authenticate with smtp-auth to get the same effect. You might find | |
412 <ulink | |
413 url="http://www.ists.dartmouth.edu/classroom/sendmail-ssl-how-to.php"> | |
414 these directions</ulink> helpful for setting up smtp-auth if you are on | |
415 RH Linux. | |
416 </para> | |
417 </refsect1> | |
94 | 418 |
111 | 419 <refsect1 id='performance.1'> |
108 | 420 <title>Performance Issues</title> |
421 <para> | |
422 Consider a high volume high performance machine running sendmail. Each | |
423 sendmail process can do its own dns resolution. Typically, such dns | |
424 resolver libraries are not thread safe, and so must be protected by some | |
425 sort of mutex in a threaded environment. When we add a milter to | |
426 sendmail, we now have a collection of sendmail processes, and a | |
427 collection of milter threads. | |
428 </para> | |
429 <para> | |
430 We will be doing a lot of dns lookups per mail message, and at least | |
431 some of those will take many tens of seconds. If all this dns work is | |
432 serialized inside the milter, we have an upper limit of about 25K mail | |
433 messages per day. That is clearly not sufficient for many sites. | |
434 </para> | |
435 <para> | |
436 Since we want to do parallel dns resolution across those milter threads, | |
437 we add another collection of dns resolver processes. Each sendmail | |
438 process is talking to a milter thread over a socket, and each milter | |
439 thread is talking to a dns resolver process over another socket. | |
440 </para> | |
441 <para> | |
442 Suppose we are processing 20 messages per second, and each message | |
443 requires 20 seconds of dns work. Then we will have 400 sendmail | |
444 processes, 400 milter threads, and 400 dns resolver processes. Of | |
445 course that steady state is very unlikely to happen. | |
446 </para> | |
447 </refsect1> | |
94 | 448 |
449 | |
111 | 450 <refsect1 id='rejected.1'> |
108 | 451 <title>Rejected Ideas</title> |
452 <para> | |
453 The following ideas have been considered and rejected. | |
454 </para> | |
455 <para> | |
111 | 456 Add max_recipients setting to the context configuration. Recipients in |
457 excess of that limit will be rejected, and all the non-whitelisted | |
458 recipients will be removed. Current spammers *very* rarely send more | |
459 than ten recipients in a single smtp transaction, so this won't stop any | |
108 | 460 significant amount of spam. |
461 </para> | |
462 <para> | |
463 Add poison addresses to the configuration. If any recipient is | |
464 poison, all recipients are rejected even if they would be whitelisted, | |
465 and the data is rejected if sent. I have a collection of spam trap | |
466 addresses that would be suitable for such use. Based on my log files, | |
467 any mail to those spam trap addresses is rejected based on either dnsbl | |
468 lookups or the DCC. So this won't result in blocking any additional | |
469 spam. | |
470 </para> | |
471 <para> | |
472 Add an option to only allow one recipient if the return path is | |
473 empty. Based on my log files, there is no mail that violates this | |
474 check. | |
475 </para> | |
476 <para> | |
477 Reject the mail if the envelope from domain name contains any MX | |
478 records pointing to 127.0.0.0/8. I don't see any significant amount of | |
479 spam sent with such domain names. | |
480 </para> | |
481 </refsect1> | |
94 | 482 |
108 | 483 <refsect1 id='todo.1'> |
484 <title>TODO</title> | |
485 <para> | |
486 The following ideas are under consideration. | |
487 </para> | |
488 <para> | |
489 Add a per-context option to reject mail if the number of digits in | |
490 the reverse dns client name exceeds some threshold. | |
491 </para> | |
115 | 492 <para> |
493 Look for href="hostname/path" strings that are missing the required | |
494 http:// protocol header. Such references are still clickable in common | |
495 mail software. | |
496 </para> | |
108 | 497 </refsect1> |
94 | 498 |
111 | 499 <refsect1 id='copyright.1'> |
108 | 500 <title>Copyright</title> |
501 <para> | |
502 Copyright (C) 2005 by 510 Software Group <carl@five-ten-sg.com> | |
503 </para> | |
504 <para> | |
505 This program is free software; you can redistribute it and/or modify it | |
506 under the terms of the GNU General Public License as published by the | |
160 | 507 Free Software Foundation; either version 3, or (at your option) any |
108 | 508 later version. |
509 </para> | |
510 <para> | |
511 You should have received a copy of the GNU General Public License along | |
512 with this program; see the file COPYING. If not, please write to the | |
513 Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
514 </para> | |
515 </refsect1> | |
94 | 516 |
111 | 517 <refsect1 id='version.1'> |
518 <title>CVS Version</title> | |
108 | 519 <para> |
520 $Id$ | |
521 </para> | |
522 </refsect1> | |
523 </refentry> | |
524 | |
525 | |
526 <refentry id="@PACKAGE@.conf.5"> | |
527 <refentryinfo> | |
161 | 528 <date>2007-07-10</date> |
108 | 529 </refentryinfo> |
94 | 530 |
108 | 531 <refmeta> |
532 <refentrytitle>@PACKAGE@.conf</refentrytitle> | |
533 <manvolnum>5</manvolnum> | |
534 <refmiscinfo>@PACKAGE@ @VERSION@</refmiscinfo> | |
535 </refmeta> | |
94 | 536 |
108 | 537 <refnamediv id='name.5'> |
538 <refname>@PACKAGE@.conf</refname> | |
111 | 539 <refpurpose>configuration file for @PACKAGE@ sendmail milter</refpurpose> |
108 | 540 </refnamediv> |
541 | |
542 <refsynopsisdiv id='synopsis.5'> | |
543 <title>Synopsis</title> | |
544 <cmdsynopsis> | |
545 <command>@PACKAGE@.conf</command> | |
546 </cmdsynopsis> | |
547 </refsynopsisdiv> | |
94 | 548 |
108 | 549 <refsect1 id='description.5'> |
550 <title>Description</title> | |
551 <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
|
552 specified by this partial bnf description. Comments start with // |
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
553 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
|
554 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
|
555 <literallayout class="monospaced"><![CDATA[include "<file>";]]></literallayout> |
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
556 </para> |
108 | 557 |
558 <literallayout class="monospaced"><![CDATA[ | |
559 CONFIG = {CONTEXT ";"}+ | |
560 CONTEXT = "context" NAME "{" {STATEMENT}+ "}" | |
153 | 561 STATEMENT = (DNSBL | DNSBLLIST | CONTENT | ENV-TO | VERIFY | |
562 AUTOWHITE | CONTEXT | ENV-FROM | RATE-LIMIT) ";" | |
108 | 563 |
124 | 564 DNSBL = "dnsbl" NAME DNSPREFIX ERROR-MSG1 |
108 | 565 |
566 DNSBLLIST = "dnsbl_list" {NAME}+ | |
94 | 567 |
108 | 568 CONTENT = "content" ("on" | "off") "{" {CONTENT-ST}+ "}" |
119 | 569 CONTENT-ST = (FILTER | URIBL | IGNORE | TLD | CCTLD | HTML-TAGS | |
570 HTML-LIMIT | HOST-LIMIT) ";" | |
124 | 571 FILTER = "filter" DNSPREFIX ERROR-MSG2 |
572 URIBL = "uribl" DNSPREFIX ERROR-MSG3 | |
108 | 573 IGNORE = "ignore" "{" {HOSTNAME [";"]}+ "}" |
574 TLD = "tld" "{" {TLD [";"]}+ "}" | |
119 | 575 CCTLD = "cctld" "{" {TLD [";"]}+ "}" |
108 | 576 HTML-TAGS = "html_tags" "{" {HTMLTAG [";"]}+ "}" |
124 | 577 ERROR-MSG1 = string containing exactly two %s replacement tokens |
578 both are replaced with the client ip address | |
579 ERROR-MSG2 = string containing exactly two %s replacement tokens | |
580 the first is replaced with the hostname, and the second | |
581 is replaced with the ip address | |
582 ERROR-MSG3 = string containing exactly two %s replacement tokens | |
583 both are replaced with the hostname | |
108 | 584 |
585 HTML-LIMIT = "html_limit" ("on" INTEGER ERROR-MSG | "off") | |
586 | |
111 | 587 HOST-LIMIT = "host_limit" ("on" INTEGER ERROR-MSG | "off" | |
588 "soft" INTEGER) | |
94 | 589 |
108 | 590 ENV-TO = "env_to" "{" {(TO-ADDR | DCC-TO)}+ "}" |
591 TO-ADDR = ADDRESS [";"] | |
592 DCC-TO = "dcc_to" ("ok" | "many") "{" DCCINCLUDEFILE "}" ";" | |
593 | |
594 VERIFY = "verify" HOSTNAME ";" | |
153 | 595 AUTOWHITE = "autowhite" DAYS FILENAME ";" |
108 | 596 |
597 ENV_FROM = "env_from" [DEFAULT] "{" {(FROM-ADDR | DCC-FROM)}+ "}" | |
598 FROM-ADDR = ADDRESS VALUE [";"] | |
599 DCC-FROM = "dcc_from" "{" DCCINCLUDEFILE "}" ";" | |
136 | 600 |
140 | 601 RATE-LIMIT = "rate_limit" [DEFAULTLIMIT] "{" (RATE)+ "}" |
136 | 602 RATE = USER LIMIT [";"] |
603 | |
108 | 604 DEFAULT = ("white" | "black" | "unknown" | "inherit" | "") |
605 ADDRESS = (USER@ | DOMAIN | USER@DOMAIN) | |
148
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
606 VALUE = ("white" | "black" | "unknown" | "inherit" | CHILD-CONTEXT-NAME)]]></literallayout> |
108 | 607 </refsect1> |
94 | 608 |
108 | 609 <refsect1 id='sample.5'> |
610 <title>Sample</title> | |
611 <literallayout class="monospaced"><![CDATA[ | |
127 | 612 context main-default { |
613 // outbound dnsbl filtering to catch our own customers that end up on the sbl | |
144
31ff00ea6bfb
allow parent/child to share a fully qualified env_to address
carl
parents:
140
diff
changeset
|
614 dnsbl localp partial.blackholes.five-ten-sg.com "Mail from %s rejected - local; see http://www.five-ten-sg.com/blackhole.php?%s"; |
127 | 615 dnsbl local blackholes.five-ten-sg.com "Mail from %s rejected - local; see http://www.five-ten-sg.com/blackhole.php?%s"; |
616 dnsbl sbl sbl-xbl.spamhaus.org "Mail from %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
617 dnsbl dul dul.dnsbl.sorbs.net "Mail from %s rejected - dul; see http://www.sorbs.net/lookup.shtml?%s"; | |
618 dnsbl_list local sbl dul; | |
619 | |
620 // outbound content filtering to prevent our own customers from sending spam | |
621 content on { | |
622 filter sbl-xbl.spamhaus.org "Mail containing %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
623 uribl multi.surbl.org "Mail containing %s rejected - surbl; see http://www.rulesemporium.com/cgi-bin/uribl.cgi?bl0=1&domain0=%s"; | |
624 #uribl black.uribl.com "Mail containing %s rejected - uribl; see http://l.uribl.com/?d=%s"; | |
625 ignore { include "hosts-ignore.conf"; }; | |
626 tld { include "tld.conf"; }; | |
627 cctld { include "cctld.conf"; }; | |
628 html_tags { include "html-tags.conf"; }; | |
629 html_limit on 20 "Mail containing excessive bad html tags rejected"; | |
630 html_limit off; | |
631 host_limit on 20 "Mail containing excessive host names rejected"; | |
632 host_limit soft 20; | |
633 }; | |
634 | |
635 // backscatter prevention - don't send bounces for mail that we accepted but could not forward | |
636 // we only send bounces to our own customers | |
637 env_from unknown { | |
638 "<>" black; | |
639 }; | |
136 | 640 |
144
31ff00ea6bfb
allow parent/child to share a fully qualified env_to address
carl
parents:
140
diff
changeset
|
641 // hourly recipient rate limit by smtp auth client id |
140 | 642 rate_limit 30 { // default |
136 | 643 fred 100; // override default limits |
140 | 644 joe 10; // "" |
136 | 645 }; |
127 | 646 }; |
647 | |
108 | 648 context sample { |
649 dnsbl local blackholes.five-ten-sg.com "Mail from %s rejected - local; see http://www.five-ten-sg.com/blackhole.php?%s"; | |
650 dnsbl sbl sbl-xbl.spamhaus.org "Mail from %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
651 dnsbl xbl xbl.spamhaus.org "Mail from %s rejected - xbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
652 dnsbl dul dul.dnsbl.sorbs.net "Mail from %s rejected - dul; see http://www.sorbs.net/lookup.shtml?%s"; | |
653 dnsbl_list local sbl dul; | |
94 | 654 |
108 | 655 content on { |
656 filter sbl-xbl.spamhaus.org "Mail containing %s rejected - sbl; see http://www.spamhaus.org/query/bl?ip=%s"; | |
122 | 657 uribl multi.surbl.org "Mail containing %s rejected - surbl; see http://www.rulesemporium.com/cgi-bin/uribl.cgi?bl0=1&domain0=%s"; |
119 | 658 #uribl black.uribl.com "Mail containing %s rejected - uribl; see http://l.uribl.com/?d=%s"; |
108 | 659 ignore { include "hosts-ignore.conf"; }; |
660 tld { include "tld.conf"; }; | |
119 | 661 cctld { include "cctld.conf"; }; |
108 | 662 html_tags { include "html-tags.conf"; }; |
663 html_limit on 20 "Mail containing excessive bad html tags rejected"; | |
664 html_limit off; | |
665 host_limit on 20 "Mail containing excessive host names rejected"; | |
666 host_limit soft 20; | |
667 }; | |
94 | 668 |
108 | 669 env_to { |
670 # child contexts are not allowed to specify recipient addresses outside these domains | |
671 # leave this outer global context env_to empty to allow arbitrary recipients in child contexts | |
672 mydomain.com; | |
673 customer1.com; | |
674 customer1a.com; | |
675 customer1b.com; | |
676 customer2.com; | |
677 customer2a.com; | |
678 customer2b.com; | |
679 }; | |
94 | 680 |
108 | 681 context whitelist { |
682 content off {}; | |
683 env_to { | |
684 # dcc_to ok { include "/var/dcc/whitecommon"; }; # copy the dcc OK values (env_to) into this context | |
685 }; | |
686 env_from white {}; # white forces all unmatched from addresses (everyone in this case) to be whitelisted | |
687 # so all mail TO these env_to addresses is accepted | |
688 }; | |
94 | 689 |
108 | 690 context minimal { |
691 dnsbl_list sbl dul; | |
692 content on {}; | |
693 env_to { | |
694 sales@mydomain.com; | |
695 }; | |
696 }; | |
94 | 697 |
108 | 698 context blacklist { |
699 env_to { | |
700 dcc_to many { include "/var/dcc/whitecommon"; }; # copy the dcc MANY values (env_to) into this context | |
701 old-employee@mydomain.com; | |
702 }; | |
703 env_from black {}; # black forces all unmatched from addresses (everyone in this case) to be blacklisted | |
704 # so all mail TO these env_to addresses is rejected | |
705 }; | |
94 | 706 |
108 | 707 context vp { # special context for the vp |
708 env_to { | |
709 vp@mydomain.com; | |
710 }; | |
711 env_from inherit { | |
712 nai.com black; # the vp does not like nai | |
713 yahoo.com unknown; # override parent context blacklisting | |
714 mother@spammyisp.com white; # suppress dnsbl checking | |
715 }; | |
716 }; | |
717 | |
718 context customer1 { | |
719 dnsbl_list sbl dul; | |
720 env_to { | |
721 customer1.com; | |
722 customer1a.com; | |
723 customer1b.com; | |
724 }; | |
94 | 725 |
153 | 726 # we can reject unknown users |
108 | 727 verify mail.customer1.com; |
94 | 728 |
153 | 729 # whitelist anyone to whom we have sent mail in the last 90 days |
730 autowhite 90 "autowhite/customer1"; | |
731 | |
108 | 732 context customer1a { |
733 env_to { | |
734 customer1a.com; | |
148
9330b8d6a56b
add documentation fixes, allow env_from target of inherit
carl
parents:
144
diff
changeset
|
735 }; |
108 | 736 env_from black { # blacklist everything |
737 first@acceptable.com unknown; # except these specific envelope senders | |
738 second@another.com unknown; | |
739 yahoo.com inherit; # delegate to the parent | |
740 }; | |
741 }; | |
742 | |
743 env_from { # default value of the default is inherit | |
744 yahoo.com black; # no mail from yahoo | |
745 first@yahoo.com unknown; # except this one | |
746 }; | |
747 }; | |
94 | 748 |
108 | 749 context customer2 { |
750 dnsbl_list sbl; | |
751 env_to { | |
752 customer2.com; | |
753 customer2a.com; | |
754 customer2b.com; | |
755 }; | |
756 }; | |
104 | 757 |
149 | 758 # this is at the end, so that these abuse@ and postmaster@ entries will |
759 # override any conflicting entries inside the customer contexts. | |
760 context abuse { | |
761 dnsbl_list xbl; | |
762 content off {}; | |
763 env_to { | |
764 abuse@; # no content filtering on abuse reports | |
765 postmaster@; # "" | |
766 }; | |
767 env_from unknown {}; # ignore all parent white/black listing | |
768 }; | |
769 | |
108 | 770 env_from unknown { |
771 dcc_from { include "/var/dcc/whitecommon"; }; # copy the dcc OK/MANY values (env_from, substitute mail_host) into this context | |
772 abuse@ abuse; # replies to abuse reports use the abuse context | |
773 yahoo.com black; # don't take mail from yahoo | |
774 spammer@example.com black; | |
775 }; | |
776 };]]></literallayout> | |
777 </refsect1> | |
94 | 778 |
111 | 779 <refsect1 id='version.5'> |
780 <title>CVS Version</title> | |
108 | 781 <para> |
782 $Id$ | |
783 </para> | |
784 </refsect1> | |
785 | |
786 </refentry> | |
787 </reference> |