~ubuntu-branches/debian/sid/postfix/sid

« back to all changes in this revision

Viewing changes to README_FILES/SMTPD_POLICY_README

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2012-03-20 13:47:16 UTC
  • mfrom: (1.1.34) (39.1.16 trunk)
  • Revision ID: package-import@ubuntu.com-20120320134716-o62kosz3odzt1rh6
Tags: 2.9.1-2
Drop unnecessary openssl check, since sonames will save us.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
PPuurrppoossee ooff PPoossttffiixx SSMMTTPP aacccceessss ppoolliiccyy ddeelleeggaattiioonn
6
6
 
7
7
The Postfix SMTP server has a number of built-in mechanisms to block or accept
8
 
mail at specific SMTP protocol stages. As of version 2.1, Postfix can delegate
9
 
policy decisions to an external server that runs outside Postfix.
 
8
mail at specific SMTP protocol stages. In addition, the Postfix SMTP server can
 
9
delegate decisions to an external policy server (Postfix 2.1 and later).
10
10
 
11
11
With this policy delegation mechanism, a simple greylist policy can be
12
12
implemented with only a dozen lines of Perl, as is shown at the end of this
71
71
    etrn_domain=
72
72
    PPoossttffiixx vveerrssiioonn 22..55 aanndd llaatteerr::
73
73
    stress=
 
74
    PPoossttffiixx vveerrssiioonn 22..99 aanndd llaatteerr::
 
75
    ccert_pubkey_fingerprint=68:B3:29:DA:98:93:E3:40:99:C7:D8:AD:5C:B9:C9:40
74
76
    [empty line]
75
77
 
76
78
Notes:
195
197
 
196
198
NOTES:
197
199
 
198
 
  * Lines 2, 11: the Postfix spawn(8) daemon by default kills its child process
199
 
    after 1000 seconds. This is too short for a policy daemon that may need to
200
 
    run for as long as the SMTP server process that talks to it. The default
201
 
    time limit is overruled in main.cf with an explicit "policy_time_limit"
202
 
    setting. The name of the parameter is the name of the master.cf entry
203
 
    ("policy") concatenated with the "_time_limit" suffix. See spawn(8) for
204
 
    more information about the time limit parameter.
 
200
  * Lines 2-3: this creates the service called "policy" that listens on a UNIX-
 
201
    domain socket. The service is implemented by the Postfix spawn(8) daemon,
 
202
    which executes the policy server program that is specified with the aarrggvv
 
203
    attribute, using the privileges specified with the uusseerr attribute.
205
204
 
206
205
  * Line 2: specify a "0" process limit instead of the default "-", to avoid
207
 
    "connection refused" and other problems when the smtpd process limit
208
 
    exceeds the default_process_limit setting.
 
206
    "connection refused" and other problems when you increase the smtpd process
 
207
    limit.
209
208
 
210
209
  * Lines 8, 9: always specify "check_policy_service" AFTER
211
210
    "reject_unauth_destination" or else your system could become an open relay.
212
211
 
 
212
  * Line 11: this increases the time that a policy server process may run to
 
213
    3600 seconds. The default time limit of 1000 seconds is too short; the
 
214
    policy daemon needs to run long as the SMTP server process that talks to
 
215
    it. See the spawn(8) manpage for more information about the
 
216
    transport_time_limit parameter.
 
217
 
 
218
        Note: the "policy_time_limit" parameter will not show up in "postconf"
 
219
        command output before Postfix version 2.9. This limitation applies to
 
220
        many parameters whose name is a combination of a master.cf service name
 
221
        (in the above example, "policy") and a built-in suffix (in the above
 
222
        example: "_time_limit").
 
223
 
213
224
  * Solaris UNIX-domain sockets do not work reliably. Use TCP sockets instead:
214
225
 
215
226
     1 /etc/postfix/master.cf:
280
291
daemon. For example, to run the script as user "nobody", using a UNIX-domain
281
292
socket that is accessible by Postfix processes only:
282
293
 
283
 
    1 /etc/postfix/master.cf:
284
 
    2     policy  unix  -       n       n       -       0       spawn
285
 
    3       user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl
286
 
    4
287
 
    5 /etc/postfix/main.cf:
288
 
    6      policy_time_limit = 3600
 
294
     1 /etc/postfix/master.cf:
 
295
     2     greylist  unix  -       n       n       -       0       spawn
 
296
     3       user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl
 
297
     4
 
298
     5 /etc/postfix/main.cf:
 
299
     6     greylist_time_limit = 3600
 
300
     7     smtpd_recipient_restrictions =
 
301
     8         ...
 
302
     9         reject_unauth_destination
 
303
    10         check_policy_service unix:private/greylist
 
304
    11         ...
289
305
 
290
306
Notes:
291
307
 
 
308
  * Lines 2-3: this creates the service called "greylist" that listens on a
 
309
    UNIX-domain socket. The service is implemented by the Postfix spawn(8)
 
310
    daemon, which executes the greylist.pl script that is specified with the
 
311
    aarrggvv attribute, using the privileges specified with the uusseerr attribute.
 
312
 
 
313
  * Line 2: specify a "0" process limit instead of the default "-", to avoid
 
314
    "connection refused" and other problems when you increase the smtpd process
 
315
    limit.
 
316
 
292
317
  * Line 3: Specify "greylist.pl -v" for verbose logging of each request and
293
318
    reply.
294
319
 
295
 
  * Lines 2, 6: the Postfix spawn(8) daemon by default kills its child process
296
 
    after 1000 seconds. This is too short for a policy daemon that may run for
297
 
    as long as an SMTP client is connected to an SMTP server process. The
298
 
    default time limit is overruled in main.cf with an explicit
299
 
    "policy_time_limit" setting. The name of the parameter is the name of the
300
 
    master.cf entry ("policy") concatenated with the "_time_limit" suffix.
 
320
  * Line 6: this increases the time that a greylist server process may run to
 
321
    3600 seconds. The default time limit of 1000 seconds is too short; the
 
322
    greylist daemon needs to run long as the SMTP server process that talks to
 
323
    it. See the spawn(8) manpage for more information about the
 
324
    transport_time_limit parameter.
301
325
 
302
 
  * Line 2: specify a "0" process limit instead of the default "-", to avoid
303
 
    "connection refused" and other problems when the smtpd process limit
304
 
    exceeds the default_process_limit setting.
 
326
        Note: the "greylist_time_limit" parameter will not show up in
 
327
        "postconf" command output before Postfix version 2.9. This limitation
 
328
        applies to many parameters whose name is a combination of a master.cf
 
329
        service name (in the above example, "greylist") and a built-in suffix
 
330
        (in the above example: "_time_limit").
305
331
 
306
332
On Solaris you must use inet: style sockets instead of unix: style, as detailed
307
333
in the "Policy client/server configuration" section above.
308
334
 
309
 
    1 /etc/postfix/master.cf:
310
 
    2     127.0.0.1:9998  inet  n       n       n       -       0       spawn
311
 
    3       user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl
312
 
    4
313
 
    5 /etc/postfix/main.cf:
314
 
    6      127.0.0.1:9998_time_limit = 3600
315
 
 
316
 
To invoke this service you would specify "check_policy_service inet:127.0.0.1:
317
 
9998".
 
335
     1 /etc/postfix/master.cf:
 
336
     2     127.0.0.1:9998  inet  n       n       n       -       0       spawn
 
337
     3       user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl
 
338
     4
 
339
     5 /etc/postfix/main.cf:
 
340
     6     127.0.0.1:9998_time_limit = 3600
 
341
     7     smtpd_recipient_restrictions =
 
342
     8         ...
 
343
     9         reject_unauth_destination
 
344
    10         check_policy_service inet:127.0.0.1:9998
 
345
    11         ...
318
346
 
319
347
GGrreeyylliissttiinngg mmaaiill ffrroomm ffrreeqquueennttllyy ffoorrggeedd ddoommaaiinnss
320
348
 
331
359
     6         check_sender_access hash:/etc/postfix/sender_access
332
360
     7         ...
333
361
     8     smtpd_restriction_classes = greylist
334
 
     9     greylist = check_policy_service unix:private/policy
 
362
     9     greylist = check_policy_service unix:private/greylist
335
363
    10
336
364
    11 /etc/postfix/sender_access:
337
365
    12     aol.com     greylist
357
385
 
358
386
GGrreeyylliissttiinngg aallll yyoouurr mmaaiill
359
387
 
360
 
If you turn on greylisting for all mail you will almost certainly want to make
361
 
exceptions for mailing lists that use one-time sender addresses, because such
362
 
mailing lists can pollute your greylist database relatively quickly.
 
388
If you turn on greylisting for all mail you may want to make exceptions for
 
389
mailing lists that use one-time sender addresses, because each message will be
 
390
delayed due to greylisting, and the one-time sender addresses can pollute your
 
391
greylist database relatively quickly. Instead of making exceptions, you can
 
392
automatically whitelist clients that survive greylisting repeatedly; this
 
393
avoids most of the delays and most of the database pollution problem.
363
394
 
364
395
     1 /etc/postfix/main.cf:
365
396
     2     smtpd_recipient_restrictions =