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