POSTSCREEN_README.html revision 1.1.1.3.2.1 1 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3
4 <head>
5
6 <title>Postfix Postscreen Howto</title>
7
8 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
9
10 </head>
11
12 <body>
13
14 <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix Postscreen Howto</h1>
15
16 <hr>
17
18 <h2> <a name="intro">Introduction</a> </h2>
19
20 <p> This document describes features that are available in Postfix
21 2.8 and later. </p>
22
23 <p> The Postfix <a href="postscreen.8.html">postscreen(8)</a> daemon provides additional protection
24 against mail server overload. One <a href="postscreen.8.html">postscreen(8)</a> process handles
25 multiple inbound SMTP connections, and decides which clients may
26 talk to a Postfix SMTP server process. By keeping spambots away,
27 <a href="postscreen.8.html">postscreen(8)</a> leaves more SMTP server processes available for
28 legitimate clients, and delays the onset of <a
29 href="STRESS_README.html">server overload</a> conditions. </p>
30
31 <p> <a href="postscreen.8.html">postscreen(8)</a> should not be used on SMTP ports that receive
32 mail from end-user clients (MUAs). In a typical deployment,
33 <a href="postscreen.8.html">postscreen(8)</a> handles the MX service on TCP port 25, while MUA
34 clients submit mail via the submission service on TCP port 587 which
35 requires client authentication. Alternatively, a site could set up
36 a dedicated, non-postscreen, "port 25" server that provides submission
37 service and client authentication, but no MX service. </p>
38
39 <p> <a href="postscreen.8.html">postscreen(8)</a> maintains a temporary whitelist for clients that
40 pass its tests; by allowing whitelisted clients to skip tests,
41 <a href="postscreen.8.html">postscreen(8)</a> minimizes its impact on legitimate email traffic.
42 </p>
43
44 <p> <a href="postscreen.8.html">postscreen(8)</a> is part of a multi-layer defense. <p>
45
46 <ul>
47
48 <li> <p> As the first layer, <a href="postscreen.8.html">postscreen(8)</a> blocks connections from
49 zombies and other spambots that are responsible for about 90% of
50 all spam. It is implemented as a single process to make this defense
51 as inexpensive as possible. </p>
52
53 <li> <p> The second layer implements more complex SMTP-level access
54 checks with <a href="SMTPD_ACCESS_README.html">Postfix SMTP servers</a>,
55 <a href="SMTPD_POLICY_README.html">policy daemons</a>, and
56 <a href="MILTER_README.html">Milter applications</a>. </p>
57
58 <li> <p> The third layer performs light-weight content inspection
59 with the Postfix built-in <a href="postconf.5.html#header_checks">header_checks</a> and <a href="postconf.5.html#body_checks">body_checks</a>. This can
60 block unacceptable attachments such as executable programs, and
61 worms or viruses with easy-to-recognize signatures. </p>
62
63 <li> <p> The fourth layer provides heavy-weight content inspection
64 with external content filters. Typical examples are <a
65 href="http://www.ijs.si/software/amavisd/">Amavisd-new</a>, <a
66 href="http://spamassassin.apache.org/">SpamAssassin</a>, and <a
67 href="MILTER_README.html">Milter applications</a>. </p>
68
69 </ul>
70
71 <p> Each layer reduces the spam volume. The general strategy is to
72 use the less expensive defenses first, and to use the more expensive
73 defenses only for the spam that remains. </p>
74
75 <p> Topics in this document: </p>
76
77 <ul>
78
79 <li> <a href="#intro">Introduction</a>
80
81 <li> <a href="#basic">The basic idea behind postscreen(8)</a>
82
83 <li> <a href="#general"> General operation </a>
84
85 <li> <a href="#quick">Quick tests before everything else</a>
86
87 <li> <a href="#before_220"> Tests before the 220 SMTP server greeting </a>
88
89 <li> <a href="#after_220">Tests after the 220 SMTP server greeting</a>
90
91 <li> <a href="#other_error">Other errors</a>
92
93 <li> <a href="#victory">When all tests succeed</a>
94
95 <li> <a href="#config"> Configuring the postscreen(8) service</a>
96
97 <li> <a href="#historical"> Historical notes and credits </a>
98
99 </ul>
100
101 <h2> <a name="basic">The basic idea behind postscreen(8)</a> </h2>
102
103 <p> Most email is spam, and most spam is sent out by zombies (malware
104 on compromised end-user computers). Wietse expects that the zombie
105 problem will get worse before things improve, if ever. Without a
106 tool like <a href="postscreen.8.html">postscreen(8)</a> that keeps the zombies away, Postfix would be
107 spending most of its resources not receiving email. </p>
108
109 <p> The main challenge for <a href="postscreen.8.html">postscreen(8)</a> is to make an is-it-a-zombie
110 decision based on a single measurement. This is necessary because
111 many zombies try to fly under the radar and avoid spamming the same
112 site repeatedly. Once <a href="postscreen.8.html">postscreen(8)</a> decides that a client is
113 not-a-zombie, it whitelists the client temporarily to avoid further
114 delays for legitimate mail. </p>
115
116 <p> Zombies have challenges too: they have only a limited amount
117 of time to deliver spam before their IP address becomes blacklisted.
118 To speed up spam deliveries, zombies make compromises in their SMTP
119 protocol implementation. For example, they speak before their turn,
120 or they ignore responses from SMTP servers and continue sending
121 mail even when the server tells them to go away. </p>
122
123 <p> <a href="postscreen.8.html">postscreen(8)</a> uses a variety of measurements to recognize
124 zombies. First, <a href="postscreen.8.html">postscreen(8)</a> determines if the remote SMTP client
125 IP address is blacklisted. Second, <a href="postscreen.8.html">postscreen(8)</a> looks for protocol
126 compromises that are made to speed up delivery. These are good
127 indicators for making is-it-a-zombie decisions based on single
128 measurements. </p>
129
130 <p> <a href="postscreen.8.html">postscreen(8)</a> does not inspect message content. Message content
131 can vary from one delivery to the next, especially with clients
132 that (also) send legitimate email. Content is not a good indicator
133 for making is-it-a-zombie decisions based on single measurements,
134 and that is the problem that <a href="postscreen.8.html">postscreen(8)</a> is focused on. </p>
135
136 <h2> <a name="general"> General operation </a> </h2>
137
138 <p> For each connection from an SMTP client, <a href="postscreen.8.html">postscreen(8)</a> performs
139 a number of tests
140 in the order as described below. Some tests introduce a delay of
141 a few seconds. <a href="postscreen.8.html">postscreen(8)</a> maintains a temporary whitelist for
142 clients that pass its tests; by allowing whitelisted clients to
143 skip tests, <a href="postscreen.8.html">postscreen(8)</a> minimizes its impact on legitimate email
144 traffic. </p>
145
146 <p> By default, <a href="postscreen.8.html">postscreen(8)</a> hands off all connections to a Postfix
147 SMTP server process after logging its findings. This mode is useful
148 for non-destructive testing. </p>
149
150 <p> In a typical production setting, <a href="postscreen.8.html">postscreen(8)</a> is configured
151 to reject mail from clients that fail one or more tests, after
152 logging the helo, sender and recipient information. </p>
153
154 <p> Note: <a href="postscreen.8.html">postscreen(8)</a> is not an SMTP proxy; this is intentional.
155 The purpose is to keep zombies away from Postfix, with minimal
156 overhead for legitimate clients. </p>
157
158 <h2> <a name="quick">Quick tests before everything else</a> </h2>
159
160 <p> Before engaging in SMTP-level tests. <a href="postscreen.8.html">postscreen(8)</a> queries a
161 number of local black and whitelists. These tests speed up the
162 handling of known clients. </p>
163
164 <ul>
165
166 <li> <a href="#perm_white_black"> Permanent white/blacklist test </a>
167
168 <li> <a href="#temp_white"> Temporary whitelist test </a>
169
170 <li> <a href="#white_veto"> MX Policy test </a>
171
172 </ul>
173
174 <h3> <a name="perm_white_black"> Permanent white/blacklist test </a> </h3>
175
176 <p> The <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a> parameter (default: <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>)
177 specifies a permanent access list for SMTP client IP addresses. Typically
178 one would specify something that whitelists local networks, followed
179 by a CIDR table for selective white- and blacklisting. </p>
180
181 <p> Example: </p>
182
183 <pre>
184 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
185 <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a> = <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>,
186 <a href="cidr_table.5.html">cidr</a>:/etc/postfix/postscreen_access.cidr
187
188 /etc/postfix/postscreen_access.<a href="cidr_table.5.html">cidr</a>:
189 # Rules are evaluated in the order as specified.
190 # Blacklist 192.168.* except 192.168.0.1.
191 192.168.0.1 permit
192 192.168.0.0/16 reject
193 </pre>
194
195 <p> See the <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a> manpage documentation for more
196 details. </p>
197
198 <p> When the SMTP client address matches a "permit" action,
199 <a href="postscreen.8.html">postscreen(8)</a> logs this with the client address and port number as:
200 </p>
201
202 <pre>
203 <b>WHITELISTED</b> <i>[address]:port</i>
204 </pre>
205
206 <p> The whitelist action is not configurable: immediately hand off the
207 connection to a Postfix SMTP server process. </p>
208
209 <p> When the SMTP client address matches a "reject" action,
210 <a href="postscreen.8.html">postscreen(8)</a> logs this with the client address and port number as:
211 </p>
212
213 <pre>
214 <b>BLACKLISTED</b> <i>[address]:port</i>
215 </pre>
216
217 <p> The <a href="postconf.5.html#postscreen_blacklist_action">postscreen_blacklist_action</a> parameter specifies the action
218 that is taken next. See "<a href="#fail_before_220">When tests
219 fail before the 220 SMTP server greeting</a>" below. </p>
220
221 <h3> <a name="temp_white"> Temporary whitelist test </a> </h3>
222
223 <p> The <a href="postscreen.8.html">postscreen(8)</a> daemon maintains a <i>temporary</i>
224 whitelist for SMTP client IP addresses that have passed all
225 the tests described below. The <a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> parameter
226 specifies the location of the temporary whitelist. The
227 temporary whitelist is not used for SMTP client addresses
228 that appear on the <i>permanent</i> access list. </p>
229
230 <p> By default the temporary whitelist is not shared with other
231 postscreen(8) daemons. See <a href="#temp_white_sharing"> Sharing
232 the temporary whitelist </a> below for alternatives. </p>
233
234 <p> When the SMTP client address appears on the temporary
235 whitelist, <a href="postscreen.8.html">postscreen(8)</a> logs this with the client address and port
236 number as: </p>
237
238 <pre>
239 <b>PASS OLD</b> <i>[address]:port</i>
240 </pre>
241
242 <p> The action is not configurable: immediately hand off the
243 connection to a Postfix SMTP server process. The client is
244 excluded from further tests until its temporary whitelist
245 entry expires, as controlled with the postscreen_*_ttl
246 parameters. Expired entries are silently renewed if possible. </p>
247
248 <h3> <a name="white_veto"> MX Policy test </a> </h3>
249
250 <p> When the remote SMTP client is not on the static access list
251 or temporary whitelist, <a href="postscreen.8.html">postscreen(8)</a> can implement a number of
252 whitelist tests, before it grants the client a temporary whitelist
253 status that allows it to talk to a Postfix SMTP server process. </p>
254
255 <p> When <a href="postscreen.8.html">postscreen(8)</a> is configured to monitor all primary and
256 backup MX addresses, it can refuse to whitelist clients that connect
257 to a backup MX address only (an old spammer trick to take advantage
258 of backup MX hosts with weaker anti-spam policies than primary MX
259 hosts). </p>
260
261 <blockquote> <p> NOTE: The following solution is for small sites.
262 Larger sites would have to share the <a href="postscreen.8.html">postscreen(8)</a> cache between
263 primary and backup MTAs, which would introduce a common point of
264 failure. </p> </blockquote>
265
266 <ul>
267
268 <li> <p> First, configure the host to listen on both primary and
269 backup MX addresses. Use the appropriate <tt>ifconfig</tt> command
270 for the local operating system, or update the appropriate configuration
271 files and "refresh" the network protocol stack. </p>
272
273 <p> <p> Second, configure Postfix to listen on the new IP address
274 (this step is needed when you have specified <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> in
275 <a href="postconf.5.html">main.cf</a>). </p>
276
277 <li> <p> Then, configure <a href="postscreen.8.html">postscreen(8)</a> to deny the temporary whitelist
278 status on the backup MX address(es). An example for Wietse's
279 server is: </p>
280
281 <pre>
282 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
283 <a href="postconf.5.html#postscreen_whitelist_interfaces">postscreen_whitelist_interfaces</a> = !168.100.189.8 <a href="DATABASE_README.html#types">static</a>:all
284 </pre>
285
286 <p> Translation: allow clients to obtain the temporary whitelist
287 status on all server IP addresses except 168.100.189.8, which is a
288 backup MX address. </p>
289
290 </ul>
291
292 <p> When a non-whitelisted client connects the backup MX address,
293 <a href="postscreen.8.html">postscreen(8)</a> logs this with the client address and port number as:
294 </p>
295
296 <pre>
297 <b>CONNECT from</b> <i>[address]:port</i> <b>to [168.100.189.8]:25</b>
298 <b>WHITELIST VETO</b> <i>[address]:port</i>
299 </pre>
300
301 <p> Translation: the client at <i>[address]:port</i> connected to
302 the backup MX address 168.100.189.8 while it was not whitelisted.
303 The client will not be granted the temporary whitelist status, even
304 if passes all the whitelist tests described below. </p>
305
306 <h2> <a name="before_220"> Tests before the 220 SMTP server greeting </a> </h2>
307
308 <p> The <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a> parameter specifies a short time
309 interval before the "220 <i>text</i>..." server greeting, where
310 <a href="postscreen.8.html">postscreen(8)</a> can run a number of tests in parallel. </p>
311
312 <p> When a good client passes these tests, and no "<a
313 href="#after_220">deep protocol tests</a>" are configured, postscreen(8)
314 adds the client to the temporary whitelist and hands off the "live"
315 connection to a Postfix SMTP server process. The client can then
316 continue as if <a href="postscreen.8.html">postscreen(8)</a> never even existed (except of course
317 for the short <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a> delay). </p>
318
319 <ul>
320
321 <li> <a href="#pregreet"> Pregreet test </a>
322
323 <li> <a href="#dnsbl"> DNS White/blacklist test </a>
324
325 <li> <a href="#fail_before_220">When tests fail before the 220 SMTP server greeting</a>
326
327 </ul>
328
329 <h3> <a name="pregreet"> Pregreet test </a> </h3>
330
331 <p> The SMTP protocol is a classic example of a protocol where the
332 server speaks before the client. <a href="postscreen.8.html">postscreen(8)</a> detects zombies
333 that are in a hurry and that speak before their turn. This test is
334 enabled by default. </p>
335
336 <p> The <a href="postconf.5.html#postscreen_greet_banner">postscreen_greet_banner</a> parameter specifies the <i>text</i>
337 portion of a "220-<i>text</i>..." teaser banner (default: $<a href="postconf.5.html#smtpd_banner">smtpd_banner</a>).
338 Note that this becomes the first part of a multi-line server greeting.
339 The <a href="postscreen.8.html">postscreen(8)</a> daemon sends this before the <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a>
340 timer is started. The purpose of the teaser banner is to confuse
341 zombies so that they speak before their turn. It has no effect on
342 SMTP clients that correctly implement the protocol. </p>
343
344 <p> To avoid problems with poorly-implemented SMTP engines in network
345 appliances or network testing tools, either exclude them from all
346 tests with the <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a> feature or else specify
347 an empty teaser banner: </p>
348
349 <pre>
350 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
351 # Exclude broken clients by whitelisting. Clients in <a href="postconf.5.html#mynetworks">mynetworks</a>
352 # should always be whitelisted.
353 <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a> = <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>,
354 <a href="cidr_table.5.html">cidr</a>:/etc/postfix/postscreen_access.cidr
355
356 /etc/postfix/postscreen_access.<a href="cidr_table.5.html">cidr</a>:
357 192.168.254.0/24 permit
358 </pre>
359
360 <pre>
361 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
362 # Disable the teaser banner (try whitelisting first if you can).
363 <a href="postconf.5.html#postscreen_greet_banner">postscreen_greet_banner</a> =
364 </pre>
365
366 <p> When an SMTP client sends a command before the
367 <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a> time has elapsed, <a href="postscreen.8.html">postscreen(8)</a> logs this as:
368 </p>
369
370 <pre>
371 <b>PREGREET</b> <i>count</i> <b>after</b> <i>time</i> <b>from</b> <i>[address]:port text...</i>
372 </pre>
373
374 <p> Translation: the client at <i>[address]:port</i> sent <i>count</i>
375 bytes before its turn to speak. This happened <i>time</i> seconds
376 after the <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a> timer was started. The <i>text</i>
377 is what the client sent (truncated to 100 bytes, and with non-printable
378 characters replaced with C-style escapes such as \r for carriage-return
379 and \n for newline). </p>
380
381 <p> The <a href="postconf.5.html#postscreen_greet_action">postscreen_greet_action</a> parameter specifies the action that
382 is taken next. See "<a href="#fail_before_220">When tests fail
383 before the 220 SMTP server greeting</a>" below. </p>
384
385 <h3> <a name="dnsbl"> DNS White/blacklist test </a> </h3>
386
387 <p> The <a href="postconf.5.html#postscreen_dnsbl_sites">postscreen_dnsbl_sites</a> parameter (default: empty) specifies
388 a list of DNS blocklist servers with optional filters and weight
389 factors (positive weights for blacklisting, negative for whitelisting).
390 These servers will be queried in parallel with the reverse client
391 IP address. This test is disabled by default. </p>
392
393 <blockquote>
394 <p>
395 CAUTION: when postscreen rejects mail, its SMTP reply contains the
396 DNSBL domain name. Use the <a href="postconf.5.html#postscreen_dnsbl_reply_map">postscreen_dnsbl_reply_map</a> feature to
397 hide "password" information in DNSBL domain names.
398 </p>
399 </blockquote>
400
401 <p> When the <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a> time has elapsed, and the combined
402 DNSBL score is equal to or greater than the <a href="postconf.5.html#postscreen_dnsbl_threshold">postscreen_dnsbl_threshold</a>
403 parameter value, <a href="postscreen.8.html">postscreen(8)</a> logs this as: </p>
404
405 <pre>
406 <b>DNSBL rank</b> <i>count</i> <b>for</b> <i>[address]:port</i>
407 </pre>
408
409 <p> Translation: the SMTP client at <i>[address]:port</i> has a combined
410 DNSBL score of <i>count</i>. </p>
411
412 <p> The <a href="postconf.5.html#postscreen_dnsbl_action">postscreen_dnsbl_action</a> parameter specifies the action that
413 is taken when the combined DNSBL score is equal to or greater than
414 the threshold. See "<a href="#fail_before_220">When tests fail
415 before the 220 SMTP server greeting</a>" below. </p>
416
417 <h3> <a name="fail_before_220">When tests fail before the 220 SMTP server greeting</a> </h3>
418
419 <p> When the client address matches the permanent blacklist, or
420 when the client fails the pregreet or DNSBL tests, the action is
421 specified with <a href="postconf.5.html#postscreen_blacklist_action">postscreen_blacklist_action</a>, <a href="postconf.5.html#postscreen_greet_action">postscreen_greet_action</a>,
422 or <a href="postconf.5.html#postscreen_dnsbl_action">postscreen_dnsbl_action</a>, respectively. </p>
423
424 <dl>
425
426 <dt> <b>ignore</b> (default) </dt>
427
428 <dd> Ignore the failure of this test. Allow other tests to complete.
429 Repeat this test the next time the client connects. This option
430 is useful for testing and collecting statistics without blocking
431 mail. </dd>
432
433 <dt> <b>enforce</b> </dt>
434
435 <dd> Allow other tests to complete. Reject attempts to deliver mail
436 with a 550 SMTP reply, and log the helo/sender/recipient information.
437 Repeat this test the next time the client connects. </dd>
438
439 <dt> <b>drop</b> </dt>
440
441 <dd> Drop the connection immediately with a 521 SMTP reply. Repeat
442 this test the next time the client connects. </dd>
443
444 </dl>
445
446 <h2> <a name="after_220">Tests after the 220 SMTP server greeting</a> </h2>
447
448 <p> In this phase of the protocol, <a href="postscreen.8.html">postscreen(8)</a> implements a
449 number of "deep protocol" tests. These tests use an SMTP protocol
450 engine that is built into the <a href="postscreen.8.html">postscreen(8)</a> server. </p>
451
452 <p> Important note: these protocol tests are disabled by default.
453 They are more intrusive than the pregreet and DNSBL tests, and they
454 have limitations as discussed next. </p>
455
456 <ul>
457
458 <li> <p> The main limitation of "after 220 greeting" tests is that
459 a new client must disconnect after passing these tests (reason:
460 postscreen is not a proxy). Then the client must reconnect from
461 the same IP address before it can deliver mail. The following
462 measures may help to avoid email delays: </p>
463
464 <ul>
465
466 <li> <p> Allow "good" clients to skip tests with the
467 <a href="postconf.5.html#postscreen_dnsbl_whitelist_threshold">postscreen_dnsbl_whitelist_threshold</a> feature (Postfix 2.11 and
468 later). This is especially effective for sites such as Google that
469 never retry immediately from the same IP address. </p>
470
471 <li> <p> Small sites: Configure <a href="postscreen.8.html">postscreen(8)</a> to listen on multiple
472 IP addresses, published in DNS as different IP addresses for the
473 same MX hostname or for different MX hostnames. This avoids mail
474 delivery delays with clients that reconnect immediately from the
475 same IP address. </p>
476
477 <li> <p> Large sites: Share the <a href="postscreen.8.html">postscreen(8)</a> cache between different
478 Postfix MTAs with a large-enough <a href="memcache_table.5.html">memcache_table(5)</a>. Again, this
479 avoids mail delivery delays with clients that reconnect immediately
480 from the same IP address. </p>
481
482 </ul>
483
484 <li> <p> <a href="postscreen.8.html">postscreen(8)</a>'s built-in SMTP engine does not implement the
485 AUTH, XCLIENT, and XFORWARD features. If you need to make these
486 services available on port 25, then do not enable the tests after
487 the 220 server greeting. </p>
488
489 <li> <p> End-user clients should connect directly to the submission
490 service, so that they never have to deal with <a href="postscreen.8.html">postscreen(8)</a>'s tests.
491 </p>
492
493 </ul>
494
495 <p> The following "after 220 greeting" tests are available: </p>
496
497 <ul>
498
499 <li> <a href="#pipelining">Command pipelining test</a>
500
501 <li> <a href="#non_smtp">Non-SMTP command test</a>
502
503 <li> <a href="#barelf">Bare newline test</a>
504
505 <li> <a href="#fail_after_220">When tests fail after the 220 SMTP server greeting</a>
506
507 </ul>
508
509 <h3> <a name="pipelining">Command pipelining test</a> </h3>
510
511 <p> By default, SMTP is a half-duplex protocol: the sender and
512 receiver send one command and one response at a time. Unlike the
513 Postfix SMTP server, <a href="postscreen.8.html">postscreen(8)</a> does not announce support
514 for ESMTP command pipelining. Therefore, clients are not allowed
515 to send multiple commands. postscreen(8)'s <a href="#after_220">deep
516 protocol test</a> for this is disabled by default. </p>
517
518 <p> With "<a href="postconf.5.html#postscreen_pipelining_enable">postscreen_pipelining_enable</a> = yes", <a href="postscreen.8.html">postscreen(8)</a> detects
519 zombies that send multiple commands, instead of sending one command
520 and waiting for the server to reply. </p>
521
522 <p> This test is opportunistically enabled when <a href="postscreen.8.html">postscreen(8)</a> has
523 to use the built-in SMTP engine anyway. This is to make <a href="postscreen.8.html">postscreen(8)</a>
524 logging more informative. </p>
525
526 <p> When a client sends multiple commands, <a href="postscreen.8.html">postscreen(8)</a> logs this
527 as: </p>
528
529 <pre>
530 <b>COMMAND PIPELINING from</b> <i>[address]:port</i> <b>after</b> <i>command</i>: <i>text</i>
531 </pre>
532
533 <p> Translation: the SMTP client at <i>[address]:port</i> sent
534 multiple SMTP commands, instead of sending one command and then
535 waiting for the server to reply. This happened after the client
536 sent <i>command</i>. The <i>text</i> shows part of the input that
537 was sent too early; it is not logged with Postfix 2.8. </p>
538
539 <p> The <a href="postconf.5.html#postscreen_pipelining_action">postscreen_pipelining_action</a> parameter specifies the action
540 that is taken next. See "<a href="#fail_after_220">When tests fail
541 after the 220 SMTP server greeting</a>" below. </p>
542
543 <h3> <a name="non_smtp">Non-SMTP command test</a> </h3>
544
545 <p> Some spambots send their mail through open proxies. A symptom
546 of this is the usage of commands such as CONNECT and other non-SMTP
547 commands. Just like the Postfix SMTP server's <a href="postconf.5.html#smtpd_forbidden_commands">smtpd_forbidden_commands</a>
548 feature, <a href="postscreen.8.html">postscreen(8)</a> has an equivalent <a href="postconf.5.html#postscreen_forbidden_commands">postscreen_forbidden_commands</a>
549 feature to block these clients. postscreen(8)'s <a href="#after_220">deep
550 protocol test</a> for this is disabled by default. </p>
551
552 <p> With "<a href="postconf.5.html#postscreen_non_smtp_command_enable">postscreen_non_smtp_command_enable</a> = yes", <a href="postscreen.8.html">postscreen(8)</a>
553 detects zombies that send commands specified with the
554 <a href="postconf.5.html#postscreen_forbidden_commands">postscreen_forbidden_commands</a> parameter. This also detects commands
555 with the syntax of a message header label. The latter is a symptom
556 that the client is sending message content after ignoring all the
557 responses from <a href="postscreen.8.html">postscreen(8)</a> that reject mail. </p>
558
559 <p> This test is opportunistically enabled when <a href="postscreen.8.html">postscreen(8)</a> has
560 to use the built-in SMTP engine anyway. This is to make <a href="postscreen.8.html">postscreen(8)</a>
561 logging more informative. </p>
562
563 <p> When a client sends non-SMTP commands, <a href="postscreen.8.html">postscreen(8)</a> logs this
564 as: </p>
565
566 <pre>
567 <b>NON-SMTP COMMAND from</b> <i>[address]:port</i> <b>after</b> <i>command: text</i>
568 </pre>
569
570 <p> Translation: the SMTP client at <i>[address]:port</i> sent a
571 command that matches the <a href="postconf.5.html#postscreen_forbidden_commands">postscreen_forbidden_commands</a>
572 parameter, or that has the syntax of a message header label (text
573 followed by optional space and ":").
574 The "<tt><b>after</b> <i>command</i></tt>" portion is logged with
575 Postfix 2.10 and later. </p>
576
577 <p> The <a href="postconf.5.html#postscreen_non_smtp_command_action">postscreen_non_smtp_command_action</a> parameter specifies
578 the action that is taken next. See "<a href="#fail_after_220">When
579 tests fail after the 220 SMTP server greeting</a>" below. </p>
580
581 <h3> <a name="barelf">Bare newline test</a> </h3>
582
583 <p> SMTP is a line-oriented protocol: lines have a limited length,
584 and are terminated with <CR><LF>. Lines ending in a
585 "bare" <LF>, that is newline not preceded by carriage return,
586 are not allowed in SMTP. postscreen(8)'s <a href="#after_220">deep
587 protocol test</a> for this is disabled by default. </p>
588
589 <p> With "<a href="postconf.5.html#postscreen_bare_newline_enable">postscreen_bare_newline_enable</a> = yes", <a href="postscreen.8.html">postscreen(8)</a>
590 detects clients that send lines ending in bare newline characters.
591 </p>
592
593 <p> This test is opportunistically enabled when <a href="postscreen.8.html">postscreen(8)</a> has
594 to use the built-in SMTP engine anyway. This is to make <a href="postscreen.8.html">postscreen(8)</a>
595 logging more informative. </p>
596
597 <p> When a client sends bare newline characters, <a href="postscreen.8.html">postscreen(8)</a> logs
598 this as:
599 </p>
600
601 <pre>
602 <b>BARE NEWLINE from</b> <i>[address]:port</i> <b>after</b> <i>command</i>
603 </pre>
604
605 <p> Translation: the SMTP client at <i>[address]:port</i> sent a bare
606 newline character, that is newline not preceded by carriage
607 return.
608 The "<tt><b>after</b> <i>command</i></tt>" portion is logged with
609 Postfix 2.10 and later. </p>
610
611 <p> The <a href="postconf.5.html#postscreen_bare_newline_action">postscreen_bare_newline_action</a> parameter specifies the
612 action that is taken next. See "<a href="#fail_after_220">When
613 tests fail after the 220 SMTP server greeting</a>" below. </p>
614
615 <h3> <a name="fail_after_220">When tests fail after the 220 SMTP server greeting</a> </h3>
616
617 <p> When the client fails the pipelining, non-SMTP command or bare
618 newline tests, the action is specified with <a href="postconf.5.html#postscreen_pipelining_action">postscreen_pipelining_action</a>,
619 <a href="postconf.5.html#postscreen_non_smtp_command_action">postscreen_non_smtp_command_action</a> or <a href="postconf.5.html#postscreen_bare_newline_action">postscreen_bare_newline_action</a>,
620 respectively. </p>
621
622 <dl>
623
624 <dt> <b>ignore</b> (default for bare newline) </dt>
625
626 <dd> Ignore the failure of this test. Allow other tests to complete.
627 Do NOT repeat this test before the result from some other test
628 expires.
629
630 This option is useful for testing and collecting statistics without
631 blocking mail permanently. </dd>
632
633 <dt> <b>enforce</b> (default for pipelining) </dt>
634
635 <dd> Allow other tests to complete. Reject attempts to deliver
636 mail with a 550 SMTP reply, and log the helo/sender/recipient
637 information. Repeat this test the next time the client connects.
638 </dd>
639
640 <dt> <b>drop</b> (default for non-SMTP commands) </dt>
641
642 <dd> Drop the connection immediately with a 521 SMTP reply. Repeat
643 this test the next time the client connects. This action is
644 compatible with the Postfix SMTP server's <a href="postconf.5.html#smtpd_forbidden_commands">smtpd_forbidden_commands</a>
645 feature. </dd>
646
647 </dl>
648
649 <h2> <a name="other_error">Other errors</a> </h2>
650
651 <p> When an SMTP client hangs up unexpectedly, <a href="postscreen.8.html">postscreen(8)</a> logs
652 this as: </p>
653
654 <pre>
655 <b>HANGUP after</b> <i>time</i> <b>from</b> <i>[address]:port</i> <b>in</b> <i>test name</i>
656 </pre>
657
658 <p> Translation: the SMTP client at <i>[address]:port</i> disconnected
659 unexpectedly, <i>time</i> seconds after the start of the
660 test named <i>test name</i>. </p>
661
662 <p> There is no punishment for hanging up. A client that hangs up
663 without sending the QUIT command can still pass all <a href="postscreen.8.html">postscreen(8)</a>
664 tests. </p>
665
666 <!--
667
668 <p> While an unexpired penalty is in effect, an SMTP client is not
669 allowed to pass any tests, and <a href="postscreen.8.html">postscreen(8)</a> logs each connection
670 with the remaining amount of penalty time as: </p>
671
672 <pre>
673 <b>PENALTY</b> <i>time</i> <b>for</b> <i>[address]:port</i>
674 </pre>
675
676 <p> During this time, all attempts by the client to deliver mail
677 will be deferred with a 450 SMTP status. </p>
678
679 -->
680
681 <p> The following errors are reported by the built-in SMTP engine.
682 This engine never accepts mail, therefore it has per-session limits
683 on the number of commands and on the session length. </p>
684
685 <pre>
686 <b>COMMAND TIME LIMIT</b> <b>from</b> <i>[address]:port</i> <b>after</b> <i>command</i>
687 </pre>
688
689 <p> Translation: the SMTP client at <i>[address]:port</i> reached the
690 per-command time limit as specified with the <a href="postconf.5.html#postscreen_command_time_limit">postscreen_command_time_limit</a>
691 parameter. The session is terminated immediately.
692 The "<tt><b>after</b> <i>command</i></tt>" portion is logged with
693 Postfix 2.10 and later. </p>
694
695 <pre>
696 <b>COMMAND COUNT LIMIT from</b> <i>[address]:port</i> <b>after</b> <i>command</i>
697 </pre>
698
699 <p> Translation: the SMTP client at <i>[address]:port</i> reached the
700 per-session command count limit as specified with the
701 <a href="postconf.5.html#postscreen_command_count_limit">postscreen_command_count_limit</a> parameter. The session is terminated
702 immediately.
703 The "<tt><b>after</b> <i>command</i></tt>" portion is logged with
704 Postfix 2.10 and later. </p>
705
706 <pre>
707 <b>COMMAND LENGTH LIMIT from</b> <i>[address]:port</i> <b>after</b> <i>command</i>
708 </pre>
709
710 <p> Translation: the SMTP client at <i>[address]:port</i> reached the
711 per-command length limit, as specified with the <a href="postconf.5.html#line_length_limit">line_length_limit</a>
712 parameter. The session is terminated immediately.
713 The "<tt><b>after</b> <i>command</i></tt>" portion is logged with
714 Postfix 2.10 and later. </p>
715
716 <p> When an SMTP client makes too many connections at the same time,
717 or when all <a href="postscreen.8.html">postscreen(8)</a> ports are busy, <a href="postscreen.8.html">postscreen(8)</a> rejects the
718 connection with a 421 status code and logs: </p>
719
720 <pre>
721 <b>NOQUEUE: reject: CONNECT from</b> <i>[address]:port</i><b>: too many connections</b>
722 <b>NOQUEUE: reject: CONNECT from</b> <i>[address]:port</i><b>: all server ports busy</b>
723 </pre>
724
725 <p> The <a href="postconf.5.html#postscreen_client_connection_count_limit">postscreen_client_connection_count_limit</a> and
726 <a href="postconf.5.html#postscreen_pre_queue_limit">postscreen_pre_queue_limit</a> parameters control these limits. </p>
727
728 <h2> <a name="victory">When all tests succeed</a> </h2>
729
730 <p> When a new SMTP client passes all tests (i.e. it is not whitelisted
731 via some mechanism), <a href="postscreen.8.html">postscreen(8)</a> logs this as: </p>
732
733 <pre>
734 <b>PASS NEW</b> <i>[address]:port</i>
735 </pre>
736
737 <p> Where <i>[address]:port</i> are the client IP address and port.
738 Then, <a href="postscreen.8.html">postscreen(8)</a>
739 creates a temporary whitelist entry that excludes the client IP
740 address from further tests until the temporary whitelist entry
741 expires, as controlled with the postscreen_*_ttl parameters. </p>
742
743 <p> When no "<a href="#after_220">deep protocol tests</a>" are
744 configured, <a href="postscreen.8.html">postscreen(8)</a> hands off the "live" connection to a Postfix
745 SMTP server process. The client can then continue as if <a href="postscreen.8.html">postscreen(8)</a>
746 never even existed (except for the short <a href="postconf.5.html#postscreen_greet_wait">postscreen_greet_wait</a> delay).
747 </p>
748
749 <p> When any "<a href="#after_220">deep protocol tests</a>" are
750 configured, <a href="postscreen.8.html">postscreen(8)</a> cannot hand off the "live" connection to
751 a Postfix SMTP server process in the middle of the session. Instead,
752 <a href="postscreen.8.html">postscreen(8)</a> defers mail delivery attempts with a 4XX status, logs
753 the helo/sender/recipient information, and waits for the client to
754 disconnect. The next time the client connects it will be allowed
755 to talk to a Postfix SMTP server process to deliver its mail.
756 <a href="postscreen.8.html">postscreen(8)</a> mitigates the impact of this limitation by giving
757 <a href="#after_220">deep protocol tests</a> a long expiration
758 time. </p>
759
760 <h2> <a name="config"> Configuring the postscreen(8) service</a>
761 </h2>
762
763 <p> <a href="postscreen.8.html">postscreen(8)</a> has been tested on FreeBSD [4-8], Linux 2.[4-6]
764 and Solaris 9 systems. </p>
765
766 <ul>
767
768 <li> <a href="#enable"> Turning on postscreen(8) without blocking
769 mail</a>
770
771 <li> <a href="#starttls"> postscreen(8) TLS configuration </a>
772
773 <li> <a href="#blocking"> Blocking mail with postscreen(8) </a>
774
775 <li> <a href="#turnoff"> Turning off postscreen(8) </a>
776
777 <li> <a href="#temp_white_sharing"> Sharing the temporary whitelist
778 </a>
779
780 </ul>
781
782 <h3> <a name="enable"> Turning on postscreen(8) without blocking mail</a> </h3>
783
784 <p> To enable the <a href="postscreen.8.html">postscreen(8)</a> service and log client information
785 without blocking mail: </p>
786
787 <ol>
788
789 <li> <p> Make sure that local clients and systems with non-standard
790 SMTP implementations are excluded from any <a href="postscreen.8.html">postscreen(8)</a> tests. The
791 default is to exclude all clients in <a href="postconf.5.html#mynetworks">mynetworks</a>. To exclude additional
792 clients, for example, third-party performance monitoring tools (these
793 tend to have broken SMTP implementations): </p>
794
795 <pre>
796 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
797 # Exclude broken clients by whitelisting. Clients in <a href="postconf.5.html#mynetworks">mynetworks</a>
798 # should always be whitelisted.
799 <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a> = <a href="postconf.5.html#permit_mynetworks">permit_mynetworks</a>,
800 <a href="cidr_table.5.html">cidr</a>:/etc/postfix/postscreen_access.cidr
801
802 /etc/postfix/postscreen_access.<a href="cidr_table.5.html">cidr</a>:
803 192.168.254.0/24 permit
804 </pre>
805
806 <li> <p> Comment out the "<tt>smtp inet ... smtpd</tt>" service
807 in <a href="master.5.html">master.cf</a>, including any "<tt>-o parameter=value</tt>" entries
808 that follow. </p>
809
810 <pre>
811 /etc/postfix/<a href="master.5.html">master.cf</a>:
812 #smtp inet n - n - - smtpd
813 # -o parameter=value ...
814 </pre>
815
816 <li> <p> Uncomment the new "<tt>smtpd pass ... smtpd</tt>" service
817 in <a href="master.5.html">master.cf</a>, and duplicate any "<tt>-o parameter=value</tt>" entries
818 from the smtpd service that was commented out in the previous step.
819 </p>
820
821 <pre>
822 /etc/postfix/<a href="master.5.html">master.cf</a>:
823 smtpd pass - - n - - smtpd
824 -o parameter=value ...
825 </pre>
826
827 <li> <p> Uncomment the new "<tt>smtp inet ... postscreen</tt>"
828 service in <a href="master.5.html">master.cf</a>. </p>
829
830 <pre>
831 /etc/postfix/<a href="master.5.html">master.cf</a>:
832 smtp inet n - n - 1 postscreen
833 </pre>
834
835 <li> <p> Uncomment the new "<tt>tlsproxy unix ... tlsproxy</tt>"
836 service in <a href="master.5.html">master.cf</a>. This service implements STARTTLS support for
837 <a href="postscreen.8.html">postscreen(8)</a>. </p>
838
839 <pre>
840 /etc/postfix/<a href="master.5.html">master.cf</a>:
841 tlsproxy unix - - n - 0 tlsproxy
842 </pre>
843
844 <li> <p> Uncomment the new "<tt>dnsblog unix ... dnsblog</tt>"
845 service in <a href="master.5.html">master.cf</a>. This service does DNSBL lookups for <a href="postscreen.8.html">postscreen(8)</a>
846 and logs results. </p>
847
848 <pre>
849 /etc/postfix/<a href="master.5.html">master.cf</a>:
850 dnsblog unix - - n - 0 dnsblog
851 </pre>
852
853 <li> <p> To enable DNSBL lookups, list some DNS blocklist sites in
854 <a href="postconf.5.html">main.cf</a>, separated by whitespace. Different sites can have different
855 weights. For example:
856
857 <pre>
858 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
859 <a href="postconf.5.html#postscreen_dnsbl_threshold">postscreen_dnsbl_threshold</a> = 2
860 <a href="postconf.5.html#postscreen_dnsbl_sites">postscreen_dnsbl_sites</a> = zen.spamhaus.org*2
861 bl.spamcop.net*1 b.barracudacentral.org*1
862 </pre>
863
864 <p> Note: if your DNSBL queries have a "secret" in the domain name,
865 you must censor this information from the <a href="postscreen.8.html">postscreen(8)</a> SMTP replies.
866 For example: </p>
867
868 <pre>
869 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
870 <a href="postconf.5.html#postscreen_dnsbl_reply_map">postscreen_dnsbl_reply_map</a> = <a href="DATABASE_README.html#types">texthash</a>:/etc/postfix/dnsbl_reply
871 </pre>
872
873 <pre>
874 /etc/postfix/dnsbl_reply:
875 # Secret DNSBL name Name in <a href="postscreen.8.html">postscreen(8)</a> replies
876 secret.zen.spamhaus.org zen.spamhaus.org
877 </pre>
878
879 <p> The <a href="DATABASE_README.html#types">texthash</a>: format is similar to <a href="DATABASE_README.html#types">hash</a>: except that there is
880 no need to run <a href="postmap.1.html">postmap(1)</a> before the file can be used, and that it
881 does not detect changes after the file is read. It is new with
882 Postfix version 2.8. </p>
883
884 <li> <p> Read the new configuration with "<tt>postfix reload</tt>".
885 </p>
886
887 </ol>
888
889 <p> Notes: </p>
890
891 <ul>
892
893 <li> <p> Some <a href="postscreen.8.html">postscreen(8)</a> configuration parameters implement
894 stress-dependent behavior. This is supported only when the default
895 value is stress-dependent (that is, "postconf -d <i>parametername</i>"
896 output shows "<i>parametername</i> =
897 ${stress?<i>something</i>}${stress:<i>something</i>}").
898 Other parameters always evaluate as if the stress value is the empty
899 string. </p>
900
901 <li> <p> See "<a href="#before_220">Tests before the 220 SMTP server
902 greeting</a>" for details about the logging from these postscreen(8)
903 tests. </p>
904
905 <li> <p> If you run Postfix 2.6 or earlier you must stop and start
906 the master daemon ("<tt>postfix stop; postfix start</tt>"). This
907 is needed because the Postfix "pass" master service type did not
908 work reliably on all systems. </p>
909
910 </ul>
911
912 <h3> <a name="starttls"> postscreen(8) TLS configuration </a> </h3>
913
914 <p> <a href="postscreen.8.html">postscreen(8)</a> TLS support is available for remote SMTP clients
915 that aren't whitelisted, including clients that need to renew their
916 temporary whitelist status. When a remote SMTP client requests TLS
917 service, <a href="postscreen.8.html">postscreen(8)</a> invisibly hands off the connection to a
918 <a href="tlsproxy.8.html">tlsproxy(8)</a> process. Then, <a href="tlsproxy.8.html">tlsproxy(8)</a> encrypts and decrypts the
919 traffic between <a href="postscreen.8.html">postscreen(8)</a> and the remote SMTP client. One
920 <a href="tlsproxy.8.html">tlsproxy(8)</a> process can handle multiple SMTP sessions. The number
921 of <a href="tlsproxy.8.html">tlsproxy(8)</a> processes slowly increases with server load, but it
922 should always be much smaller than the number of <a href="postscreen.8.html">postscreen(8)</a> TLS
923 sessions. </p>
924
925 <p> TLS support for <a href="postscreen.8.html">postscreen(8)</a> and <a href="tlsproxy.8.html">tlsproxy(8)</a> uses the same
926 parameters as with <a href="smtpd.8.html">smtpd(8)</a>. We recommend that you keep the relevant
927 configuration parameters in <a href="postconf.5.html">main.cf</a>. If you must specify "-o
928 smtpd_mumble=value" parameter overrides in <a href="master.5.html">master.cf</a> for a
929 postscreen-protected <a href="smtpd.8.html">smtpd(8)</a> service, then you should specify those
930 same parameter overrides for the <a href="postscreen.8.html">postscreen(8)</a> and <a href="tlsproxy.8.html">tlsproxy(8)</a>
931 services. </p>
932
933 <h3> <a name="blocking"> Blocking mail with postscreen(8) </a> </h3>
934
935 <p> For compatibility with <a href="smtpd.8.html">smtpd(8)</a>, <a href="postscreen.8.html">postscreen(8)</a> implements the
936 <a href="postconf.5.html#soft_bounce">soft_bounce</a> safety feature. This causes Postfix to reject mail with
937 a "try again" reply code. </p>
938
939 <ul>
940
941 <li> <p> To turn this on for all of Postfix, specify "<tt><a href="postconf.5.html#soft_bounce">soft_bounce</a>
942 = yes</tt>" in <a href="postconf.5.html">main.cf</a>. </p>
943
944 <li> <p> To turn this on for <a href="postscreen.8.html">postscreen(8)</a> only, append "<tt>-o
945 <a href="postconf.5.html#soft_bounce">soft_bounce</a>=yes</tt>" (note: NO SPACES around '=') to the postscreen
946 entry in <a href="master.5.html">master.cf</a>. <p>
947
948 </ul>
949
950 <p> Execute "<tt>postfix reload</tt>" to make the change effective. </p>
951
952 <p> After testing, do not forget to remove the <a href="postconf.5.html#soft_bounce">soft_bounce</a> feature,
953 otherwise senders won't receive their non-delivery notification
954 until many days later. </p>
955
956 <p> To use the <a href="postscreen.8.html">postscreen(8)</a> service to block mail, edit <a href="postconf.5.html">main.cf</a> and
957 specify one or more of: </p>
958
959 <ul>
960
961 <li> <p> "<tt><a href="postconf.5.html#postscreen_dnsbl_action">postscreen_dnsbl_action</a> = enforce</tt>", to reject
962 clients that are on DNS blocklists, and to log the helo/sender/recipient
963 information. With good DNSBLs this reduces the amount of load on
964 Postfix SMTP servers dramatically. </p>
965
966 <li> <p> "<tt><a href="postconf.5.html#postscreen_greet_action">postscreen_greet_action</a> = enforce</tt>", to reject
967 clients that talk before their turn, and to log the helo/sender/recipient
968 information. This stops over half of all known-to-be illegitimate
969 connections to Wietse's mail server. It is backup protection for
970 zombies that haven't yet been blacklisted. </p>
971
972 <li> <p> You can also enable "<a href="#after_220">deep protocol
973 tests</a>", but these are more intrusive than the pregreet or DNSBL
974 tests. </p>
975
976 <p> When a good client passes the "<a href="#after_220">deep
977 protocol tests</a>", postscreen(8) adds the client to the temporary
978 whitelist but it cannot hand off the "live" connection to a Postfix
979 SMTP server process in the middle of the session. Instead, <a href="postscreen.8.html">postscreen(8)</a>
980 defers mail delivery attempts with a 4XX status, logs the
981 helo/sender/recipient information, and waits for the client to
982 disconnect. </p>
983
984 <p> When the good client comes back in a later session, it is allowed
985 to talk directly to a Postfix SMTP server. See "after_220 <a
986 href="#after_220">Tests after the 220 SMTP server greeting</a> above
987 for limitations with AUTH and other features that clients may need.
988 </p>
989
990 <p> An unexpected benefit from "<a href="#after_220">deep protocol
991 tests</a>" is that some "good" clients don't return after the 4XX
992 reply; these clients were not so good after all. Wietse enables
993 "<a href="#after_220">deep protocol tests</a>" on his own internet-facing
994 mail server. </p>
995
996 <li> <p> There is also support for permanent blacklisting and
997 whitelisting; see the description of the <a href="postconf.5.html#postscreen_access_list">postscreen_access_list</a>
998 parameter for details. </p>
999
1000 </ul>
1001
1002 <h3> <a name="turnoff"> Turning off postscreen(8) </a> </h3>
1003
1004 <p> To turn off <a href="postscreen.8.html">postscreen(8)</a> and handle mail directly with Postfix
1005 SMTP server processes: </p>
1006
1007 <ol>
1008
1009 <li> <p> Comment out the "<tt>smtp inet ... postscreen</tt>" service
1010 in <a href="master.5.html">master.cf</a>, including any "<tt>-o parameter=value</tt>" entries
1011 that follow. </p>
1012
1013 <pre>
1014 /etc/postfix/<a href="master.5.html">master.cf</a>:
1015 #smtp inet n - n - 1 postscreen
1016 # -o parameter=value ...
1017 </pre>
1018
1019 <li> <p> Comment out the "<tt>dnsblog unix ... dnsblog</tt>" service
1020 in <a href="master.5.html">master.cf</a>. </p>
1021
1022 <pre>
1023 /etc/postfix/<a href="master.5.html">master.cf</a>:
1024 #dnsblog unix - - n - 0 dnsblog
1025 </pre>
1026
1027 <li> <p> Comment out the "<tt>smtpd pass ... smtpd</tt>" service
1028 in <a href="master.5.html">master.cf</a>, including any "<tt>-o parameter=value</tt>" entries
1029 that follow. </p>
1030
1031 <pre>
1032 /etc/postfix/<a href="master.5.html">master.cf</a>:
1033 #smtpd pass - - n - - smtpd
1034 # -o parameter=value ...
1035 </pre>
1036
1037 <li> <p> Comment out the "<tt>tlsproxy unix ... tlsproxy</tt>"
1038 service in <a href="master.5.html">master.cf</a>, including any "<tt>-o parameter=value</tt>"
1039 entries that follow. </p>
1040
1041 <pre>
1042 /etc/postfix/<a href="master.5.html">master.cf</a>:
1043 #tlsproxy unix - - n - 0 tlsproxy
1044 # -o parameter=value ...
1045 </pre>
1046
1047 <li> <p> Uncomment the "<tt>smtp inet ... smtpd</tt>" service in
1048 <a href="master.5.html">master.cf</a>, including any "<tt>-o parameter=value</tt>" entries that
1049 may follow. </p>
1050
1051 <pre>
1052 /etc/postfix/<a href="master.5.html">master.cf</a>:
1053 smtp inet n - n - - smtpd
1054 -o parameter=value ...
1055 </pre>
1056
1057 <li> <p> Read the new configuration with "<tt>postfix reload</tt>".
1058 </p>
1059
1060 </ol>
1061
1062 <h3> <a name="temp_white_sharing"> Sharing the temporary whitelist </a> </h3>
1063
1064 <p> By default, the temporary whitelist is not shared between
1065 multiple <a href="postscreen.8.html">postscreen(8)</a> daemons. To enable sharing, choose one
1066 of the following options: </p>
1067
1068 <ul>
1069
1070 <li> <p> A non-persistent <a href="memcache_table.5.html">memcache</a>: temporary whitelist can be shared
1071 between <a href="postscreen.8.html">postscreen(8)</a> daemons on the same host or different
1072 hosts. Disable cache cleanup (<a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a>
1073 = 0) in all <a href="postscreen.8.html">postscreen(8)</a> daemons because <a href="memcache_table.5.html">memcache</a>: does not
1074 implement this (but see example 4 below for <a href="memcache_table.5.html">memcache</a>: with
1075 persistent backup). This requires Postfix 2.9 or later. </p>
1076
1077 <pre>
1078 # Example 1: non-persistent <a href="memcache_table.5.html">memcache</a>: whitelist.
1079 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
1080 <a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> = <a href="memcache_table.5.html">memcache</a>:/etc/postfix/postscreen_cache
1081 <a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0
1082
1083 /etc/postfix/postscreen_cache:
1084 memcache = inet:127.0.0.1:11211
1085 key_format = postscreen:%s
1086 </pre>
1087
1088 <li> <p>
1089 A persistent <a href="lmdb_table.5.html">lmdb</a>: temporary whitelist can be shared between
1090 <a href="postscreen.8.html">postscreen(8)</a> daemons that run under the same <a href="master.8.html">master(8)</a> daemon,
1091 or under different <a href="master.8.html">master(8)</a> daemons on the same host. Disable
1092 cache cleanup (<a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0) in all
1093 <a href="postscreen.8.html">postscreen(8)</a> daemons except one that is responsible for cache
1094 cleanup. This requires Postfix 2.11 or later. </p>
1095
1096 <pre>
1097 # Example 2: persistent <a href="lmdb_table.5.html">lmdb</a>: whitelist.
1098 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
1099 <a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> = <a href="lmdb_table.5.html">lmdb</a>:$<a href="postconf.5.html#data_directory">data_directory</a>/postscreen_cache
1100 # See note 1 below.
1101 # <a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0
1102 </pre>
1103
1104 <li> <p> Other kinds of persistent temporary whitelist can be shared
1105 only between <a href="postscreen.8.html">postscreen(8)</a> daemons that run under the same
1106 <a href="master.8.html">master(8)</a> daemon. In this case, temporary whitelist access must
1107 be shared through the <a href="proxymap.8.html">proxymap(8)</a> daemon. This requires Postfix
1108 2.9 or later. </p>
1109
1110 <pre>
1111 # Example 3: proxied <a href="DATABASE_README.html#types">btree</a>: whitelist.
1112 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
1113 <a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> =
1114 <a href="proxymap.8.html">proxy</a>:<a href="DATABASE_README.html#types">btree</a>:/var/lib/postfix/postscreen_cache
1115 # See note 1 below.
1116 # <a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0
1117
1118 # Example 4: proxied <a href="DATABASE_README.html#types">btree</a>: whitelist with <a href="memcache_table.5.html">memcache</a>: accelerator.
1119 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
1120 <a href="postconf.5.html#postscreen_cache_map">postscreen_cache_map</a> = <a href="memcache_table.5.html">memcache</a>:/etc/postfix/postscreen_cache
1121 <a href="postconf.5.html#proxy_write_maps">proxy_write_maps</a> =
1122 <a href="proxymap.8.html">proxy</a>:<a href="DATABASE_README.html#types">btree</a>:/var/lib/postfix/postscreen_cache
1123 ... other proxied tables ...
1124 # See note 1 below.
1125 # <a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a> = 0
1126
1127 /etc/postfix/postscreen_cache:
1128 # Note: the $<a href="postconf.5.html#data_directory">data_directory</a> macro is not defined in this context.
1129 memcache = inet:127.0.0.1:11211
1130 backup = <a href="proxymap.8.html">proxy</a>:<a href="DATABASE_README.html#types">btree</a>:/var/lib/postfix/postscreen_cache
1131 key_format = postscreen:%s
1132 </pre>
1133
1134 <p> Note 1: disable cache cleanup (<a href="postconf.5.html#postscreen_cache_cleanup_interval">postscreen_cache_cleanup_interval</a>
1135 = 0) in all <a href="postscreen.8.html">postscreen(8)</a> daemons except one that is responsible
1136 for cache cleanup. </p>
1137
1138 <p> Note 2: <a href="postscreen.8.html">postscreen(8)</a> cache sharing via <a href="proxymap.8.html">proxymap(8)</a> requires Postfix
1139 2.9 or later; earlier <a href="proxymap.8.html">proxymap(8)</a> implementations don't support
1140 cache cleanup. </p>
1141
1142 </ul>
1143
1144 <h2> <a name="historical"> Historical notes and credits </a> </h2>
1145
1146 <p> Many ideas in <a href="postscreen.8.html">postscreen(8)</a> were explored in earlier work by
1147 Michael Tokarev, in OpenBSD spamd, and in MailChannels Traffic
1148 Control. </p>
1149
1150 <p> Wietse threw together a crude prototype with pregreet and dnsbl
1151 support in June 2009, because he needed something new for a Mailserver
1152 conference presentation in July. Ralf Hildebrandt ran this code on
1153 several servers to collect real-world statistics. This version used
1154 the <a href="dnsblog.8.html">dnsblog(8)</a> ad-hoc DNS client program. </p>
1155
1156 <p> Wietse needed new material for a LISA conference presentation
1157 in November 2010, so he added support for DNSBL weights and filters
1158 in August, followed by a major code rewrite, deep protocol tests,
1159 helo/sender/recipient logging, and stress-adaptive behavior in
1160 September. Ralf Hildebrandt ran this code on several servers to
1161 collect real-world statistics. This version still used the embarrassing
1162 <a href="dnsblog.8.html">dnsblog(8)</a> ad-hoc DNS client program. </p>
1163
1164 <p> Wietse added STARTTLS support in December 2010. This makes
1165 <a href="postscreen.8.html">postscreen(8)</a> usable for sites that require TLS support. The
1166 implementation introduces the <a href="tlsproxy.8.html">tlsproxy(8)</a> event-driven TLS proxy
1167 that decrypts/encrypts the sessions for multiple SMTP clients. </p>
1168
1169 <p> The <a href="tlsproxy.8.html">tlsproxy(8)</a> implementation led to the discovery of a "new"
1170 class of vulnerability (<a
1171 href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-0411"
1172 >CVE-2011-0411</a>) that affected multiple implementations of SMTP,
1173 POP, IMAP, NNTP, and FTP over TLS. </p>
1174
1175 <p> <a href="postscreen.8.html">postscreen(8)</a> was officially released as part of the Postfix
1176 2.8 stable release in January 2011.</p>
1177
1178 </body>
1179
1180 </html>
1181
1182