]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.7-20210815
authorWietse Venema <wietse@porcupine.org>
Sun, 15 Aug 2021 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Wed, 19 Jan 2022 06:36:07 +0000 (01:36 -0500)
28 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES
postfix/TODO [new file with mode: 0644]
postfix/html/lmtp.8.html
postfix/html/postconf.5.html
postfix/html/smtp.8.html
postfix/html/smtpd.8.html
postfix/man/man5/postconf.5
postfix/man/man8/smtp.8
postfix/man/man8/smtpd.8
postfix/mantools/postlink
postfix/proto/postconf.proto
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/global/smtp_stream.c
postfix/src/global/smtp_stream.h
postfix/src/postconf/postconf_builtin.c
postfix/src/postlog/Makefile.in
postfix/src/postlog/postlog.c
postfix/src/posttls-finger/posttls-finger.c
postfix/src/smtp/lmtp_params.c
postfix/src/smtp/smtp.c
postfix/src/smtp/smtp_params.c
postfix/src/smtp/smtp_proto.c
postfix/src/smtpd/smtpd.c
postfix/src/tlsproxy/tlsproxy.c
postfix/src/util/vstream.c
postfix/src/util/vstream.h

index 6fd01ea076e07dbab9990d41cf2fcadb458a2339..4a589b54d4748f5b50453f137352ca3b432dd73c 100644 (file)
@@ -25696,6 +25696,8 @@ Apologies for any names omitted.
        Cleanup: left-over code from a DANE on/off workaround. File:
        tlsproxy.c/tlsproxy.c.
 
+20210806
+
        Constified the object argument of functions that write objects
        to VSTREAM. Files: global/bounce.c, global/defer.c,
        global/deliver_pass.c, global/deliver_request.c,
@@ -25721,7 +25723,7 @@ Apologies for any names omitted.
        suggests UNIX-domain pathname syntax which is confusing. File:
        until/inet_connect.c.
 
-20210814
+20210815
 
        To make the maillog_file feature more useful, the postlog(1)
        command is now set-gid postdrop, so that unprivileged
@@ -25729,3 +25731,21 @@ Apologies for any names omitted.
        Adopted some code from postqueue(1) and postdrop(1) to
        harden postlog(1) against privilege escalation attacks.
        Files: postlog/postlog.c, conf/postfix-files.
+
+       Hardening: specify smtpd_per_request_deadline=yes to limit
+       the combined amount of time to receive a complete SMTP
+       request and to send a complete SMTP response. Specify
+       smtpd_min_data_rate to enforce a minimum data rate during
+       DATA and BDAT. This replaces smtpd_per_record_deadline; the
+       new smtpd_per_request_deadline parameter has a backwards-
+       compatible default value.
+
+       Hardening: specify {smtp,lmtp}_per_request_deadline=yes to
+       limit the combined amount of time to send a complete SMTP
+       request and to receive a complete SMTP response. Specify
+       {smtp,lmtp}_min_data_rate to enforce a minimum data rate
+       during DATA. This replaces {smtp,lmtp}_per_record_deadline.
+       The new {smtp,lmtp}_per_request_deadline parameters have a
+       backwards-compatible default value.
+
+       Minor text and code cleanups. File: postlog/postlog.c.
index b7726304dff673b0416f044c51154d9a87bb3778..8f8f4f3515494bdc28b0862a30ec7b4803909dac 100644 (file)
@@ -25,6 +25,35 @@ more recent Eclipse Public License 2.0. Recipients can choose to take
 the software under the license of their choice. Those who are more
 comfortable with the IPL can continue with that license.
 
+Major changes with snapshot 20210814-nonprod
+============================================
+
+Updated defense against remote clients or servers that 'trickle'
+SMTP or LMTP traffc. The new {smtpd,smtp,lmtp}_per_request_deadline
+parameters replace {smtpd,smtp,lmtp}_per_record_deadline, with
+backwards compatible default settings. This defense is automatically
+enabled by default in the Postfix SMTP server in case of overload.
+
+The new smtpd_per_record_deadline parameter limits the combined
+time for the Postfix SMTP server to receive a request and to send
+a response, while the new {smtp,lmtp}_per_record_deadline parameters
+limit the combined time for the Postfix SMTP or LMTP client to send
+a request and to receive a response.
+
+Additionally, the new smtpd_min_data_rate parameter enforces a
+minimum plaintext data transfer rate for DATA and BDAT requests,
+but only when smtpd_per_record_deadline is enabled. After a read
+operation transfers N plaintext bytes (possibly after TLS decryption),
+and after the DATA or BDAT request deadline is decreased by the
+elapsed time of that read operation, the DATA or BDAT request
+deadline is increased by N/smtpd_min_data_rate seconds. However,
+the deadline is never increased beyond the smtpd_timeout value. The
+default minimum data rate is 500 (bytes/second) but is still subject
+to change.
+
+The new {smtp,lmtp}_min_data_rate parameters enforce the corresponding
+minimum DATA transfer rates for the Postfix SMTP and LMTP client.
+
 Major changes with snapshot 20210605
 ====================================
 
diff --git a/postfix/TODO b/postfix/TODO
new file mode 100644 (file)
index 0000000..274bf9b
--- /dev/null
@@ -0,0 +1,5 @@
+Add a note to tlsproxy source why it does not enforce deadlines or
+minimum data rates. Reason: tlsproxy relies on the plaintext client
+to enforce their context-dependent deadlines and data rates. When
+a plaintext client times out, it will close the tlsproxy connection,
+and then tlsproxy will also hang up.
index f8bde52a3fa3efb4ffb75e84aae450c3a39a3282..2f654e0a633de87ea943c9046f86b918dcb4526d 100644 (file)
@@ -324,7 +324,7 @@ SMTP(8)                                                                SMTP(8)
        <b><a href="postconf.5.html#smtp_dns_resolver_options">smtp_dns_resolver_options</a> (empty)</b>
               DNS Resolver options for the Postfix SMTP client.
 
-       Available in Postfix version 2.9 and later:
+       Available in Postfix version 2.9 - 3.6:
 
        <b><a href="postconf.5.html#smtp_per_record_deadline">smtp_per_record_deadline</a> (no)</b>
               Change the behavior of the smtp_*_timeout time  limits,  from  a
@@ -333,6 +333,8 @@ SMTP(8)                                                                SMTP(8)
               response  line,  SMTP message content line, or TLS protocol mes-
               sage).
 
+       Available in Postfix version 2.9 and later:
+
        <b><a href="postconf.5.html#smtp_send_dummy_mail_auth">smtp_send_dummy_mail_auth</a> (no)</b>
               Whether or not to append the "AUTH=&lt;&gt;" option to the  MAIL  FROM
               command in SASL-authenticated SMTP sessions.
@@ -372,11 +374,24 @@ SMTP(8)                                                                SMTP(8)
               ".") that Postfix may use to determine whether DNSSEC validation
               is available.
 
-       <b>known_tcp_ports  (lmtp=24,  smtp=25,   smtps=submissions=465,   submis-</b>
+       <b><a href="postconf.5.html#known_tcp_ports">known_tcp_ports</a>  (lmtp=24,  smtp=25,   smtps=submissions=465,   submis-</b>
        <b>sion=587)</b>
               Optional setting that avoids lookups in  the  <b>services</b>(5)  data-
               base.
 
+       Available in Postfix version 3.7 and later:
+
+       <b><a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a> (no)</b>
+              Change  the  behavior  of the smtp_*_timeout time limits, from a
+              time limit per plaintext or TLS read or write call,  to  a  com-
+              bined  time  limit  for  sending a complete SMTP request and for
+              receiving a complete SMTP response.
+
+       <b><a href="postconf.5.html#smtp_min_data_rate">smtp_min_data_rate</a> (500)</b>
+              The minimum plaintext data transfer  rate  in  bytes/second  for
+              DATA    requests,    when    deadlines    are    enabled    with
+              <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>.
+
 <b>MIME PROCESSING CONTROLS</b>
        Available in Postfix version 2.0 and later:
 
@@ -393,7 +408,7 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.1 and later:
 
        <b><a href="postconf.5.html#smtp_send_xforward_command">smtp_send_xforward_command</a> (no)</b>
-              Send the non-standard XFORWARD command  when  the  Postfix  SMTP
+              Send  the  non-standard  XFORWARD  command when the Postfix SMTP
               server EHLO response announces XFORWARD support.
 
 <b>SASL AUTHENTICATION CONTROLS</b>
@@ -401,62 +416,62 @@ SMTP(8)                                                                SMTP(8)
               Enable SASL authentication in the Postfix SMTP client.
 
        <b><a href="postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps</a> (empty)</b>
-              Optional  Postfix  SMTP  client  lookup  tables  with  one user-
-              name:password entry per  sender,  remote  hostname  or  next-hop
+              Optional Postfix  SMTP  client  lookup  tables  with  one  user-
+              name:password  entry  per  sender,  remote  hostname or next-hop
               domain.
 
        <b><a href="postconf.5.html#smtp_sasl_security_options">smtp_sasl_security_options</a> (noplaintext, noanonymous)</b>
               Postfix SMTP client SASL security options; as of Postfix 2.3 the
-              list of available features depends on the SASL client  implemen-
+              list  of available features depends on the SASL client implemen-
               tation that is selected with <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a></b>.
 
        Available in Postfix version 2.2 and later:
 
        <b><a href="postconf.5.html#smtp_sasl_mechanism_filter">smtp_sasl_mechanism_filter</a> (empty)</b>
-              If  non-empty,  a Postfix SMTP client filter for the remote SMTP
+              If non-empty, a Postfix SMTP client filter for the  remote  SMTP
               server's list of offered SASL mechanisms.
 
        Available in Postfix version 2.3 and later:
 
        <b><a href="postconf.5.html#smtp_sender_dependent_authentication">smtp_sender_dependent_authentication</a> (no)</b>
               Enable  sender-dependent  authentication  in  the  Postfix  SMTP
-              client;  this  is  available  only with SASL authentication, and
-              disables SMTP connection caching to ensure that mail  from  dif-
+              client; this is available only  with  SASL  authentication,  and
+              disables  SMTP  connection caching to ensure that mail from dif-
               ferent senders will use the appropriate credentials.
 
        <b><a href="postconf.5.html#smtp_sasl_path">smtp_sasl_path</a> (empty)</b>
               Implementation-specific information that the Postfix SMTP client
-              passes through  to  the  SASL  plug-in  implementation  that  is
+              passes  through  to  the  SASL  plug-in  implementation  that is
               selected with <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a></b>.
 
        <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a> (cyrus)</b>
-              The  SASL  plug-in  type that the Postfix SMTP client should use
+              The SASL plug-in type that the Postfix SMTP  client  should  use
               for authentication.
 
        Available in Postfix version 2.5 and later:
 
        <b><a href="postconf.5.html#smtp_sasl_auth_cache_name">smtp_sasl_auth_cache_name</a> (empty)</b>
-              An optional table to prevent repeated SASL authentication  fail-
-              ures  with  the  same  remote SMTP server hostname, username and
+              An  optional table to prevent repeated SASL authentication fail-
+              ures with the same remote SMTP  server  hostname,  username  and
               password.
 
        <b><a href="postconf.5.html#smtp_sasl_auth_cache_time">smtp_sasl_auth_cache_time</a> (90d)</b>
-              The maximal age of an <a href="postconf.5.html#smtp_sasl_auth_cache_name">smtp_sasl_auth_cache_name</a> entry before  it
+              The  maximal age of an <a href="postconf.5.html#smtp_sasl_auth_cache_name">smtp_sasl_auth_cache_name</a> entry before it
               is removed.
 
        <b><a href="postconf.5.html#smtp_sasl_auth_soft_bounce">smtp_sasl_auth_soft_bounce</a> (yes)</b>
-              When  a remote SMTP server rejects a SASL authentication request
-              with a 535 reply code, defer mail delivery instead of  returning
+              When a remote SMTP server rejects a SASL authentication  request
+              with  a 535 reply code, defer mail delivery instead of returning
               mail as undeliverable.
 
        Available in Postfix version 2.9 and later:
 
        <b><a href="postconf.5.html#smtp_send_dummy_mail_auth">smtp_send_dummy_mail_auth</a> (no)</b>
-              Whether  or  not to append the "AUTH=&lt;&gt;" option to the MAIL FROM
+              Whether or not to append the "AUTH=&lt;&gt;" option to the  MAIL  FROM
               command in SASL-authenticated SMTP sessions.
 
 <b>STARTTLS SUPPORT CONTROLS</b>
-       Detailed information about STARTTLS configuration may be found  in  the
+       Detailed  information  about STARTTLS configuration may be found in the
        <a href="TLS_README.html">TLS_README</a> document.
 
        <b><a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a> (empty)</b>
@@ -466,20 +481,20 @@ SMTP(8)                                                                SMTP(8)
               <a href="postconf.5.html#smtp_tls_enforce_peername">smtp_tls_enforce_peername</a>.
 
        <b><a href="postconf.5.html#smtp_sasl_tls_security_options">smtp_sasl_tls_security_options</a> ($<a href="postconf.5.html#smtp_sasl_security_options">smtp_sasl_security_options</a>)</b>
-              The SASL authentication security options that the  Postfix  SMTP
+              The  SASL  authentication security options that the Postfix SMTP
               client uses for TLS encrypted SMTP sessions.
 
        <b><a href="postconf.5.html#smtp_starttls_timeout">smtp_starttls_timeout</a> (300s)</b>
-              Time  limit  for  Postfix  SMTP client write and read operations
+              Time limit for Postfix SMTP client  write  and  read  operations
               during TLS startup and shutdown handshake procedures.
 
        <b><a href="postconf.5.html#smtp_tls_CAfile">smtp_tls_CAfile</a> (empty)</b>
-              A file containing CA certificates of root CAs  trusted  to  sign
-              either  remote  SMTP server certificates or intermediate CA cer-
+              A  file  containing  CA certificates of root CAs trusted to sign
+              either remote SMTP server certificates or intermediate  CA  cer-
               tificates.
 
        <b><a href="postconf.5.html#smtp_tls_CApath">smtp_tls_CApath</a> (empty)</b>
-              Directory with PEM format Certification  Authority  certificates
+              Directory  with  PEM format Certification Authority certificates
               that the Postfix SMTP client uses to verify a remote SMTP server
               certificate.
 
@@ -487,7 +502,7 @@ SMTP(8)                                                                SMTP(8)
               File with the Postfix SMTP client RSA certificate in PEM format.
 
        <b><a href="postconf.5.html#smtp_tls_mandatory_ciphers">smtp_tls_mandatory_ciphers</a> (medium)</b>
-              The  minimum  TLS cipher grade that the Postfix SMTP client will
+              The minimum TLS cipher grade that the Postfix SMTP  client  will
               use with mandatory TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_exclude_ciphers">smtp_tls_exclude_ciphers</a> (empty)</b>
@@ -495,8 +510,8 @@ SMTP(8)                                                                SMTP(8)
               client cipher list at all TLS security levels.
 
        <b><a href="postconf.5.html#smtp_tls_mandatory_exclude_ciphers">smtp_tls_mandatory_exclude_ciphers</a> (empty)</b>
-              Additional  list  of ciphers or cipher types to exclude from the
-              Postfix SMTP client cipher list at mandatory TLS  security  lev-
+              Additional list of ciphers or cipher types to exclude  from  the
+              Postfix  SMTP  client cipher list at mandatory TLS security lev-
               els.
 
        <b><a href="postconf.5.html#smtp_tls_dcert_file">smtp_tls_dcert_file</a> (empty)</b>
@@ -512,7 +527,7 @@ SMTP(8)                                                                SMTP(8)
               Enable additional Postfix SMTP client logging of TLS activity.
 
        <b><a href="postconf.5.html#smtp_tls_note_starttls_offer">smtp_tls_note_starttls_offer</a> (no)</b>
-              Log the hostname of a remote SMTP server that  offers  STARTTLS,
+              Log  the  hostname of a remote SMTP server that offers STARTTLS,
               when TLS is not already enabled for that server.
 
        <b><a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a> (empty)</b>
@@ -521,14 +536,14 @@ SMTP(8)                                                                SMTP(8)
               fied, this overrides the obsolete <a href="postconf.5.html#smtp_tls_per_site">smtp_tls_per_site</a> parameter.
 
        <b><a href="postconf.5.html#smtp_tls_mandatory_protocols">smtp_tls_mandatory_protocols</a> (see 'postconf -d' output)</b>
-              TLS  protocols that the Postfix SMTP client will use with manda-
+              TLS protocols that the Postfix SMTP client will use with  manda-
               tory TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_scert_verifydepth">smtp_tls_scert_verifydepth</a> (9)</b>
               The verification depth for remote SMTP server certificates.
 
        <b><a href="postconf.5.html#smtp_tls_secure_cert_match">smtp_tls_secure_cert_match</a> (nexthop, dot-nexthop)</b>
-              How the Postfix SMTP  client  verifies  the  server  certificate
+              How  the  Postfix  SMTP  client  verifies the server certificate
               peername for the "secure" TLS security level.
 
        <b><a href="postconf.5.html#smtp_tls_session_cache_database">smtp_tls_session_cache_database</a> (empty)</b>
@@ -536,16 +551,16 @@ SMTP(8)                                                                SMTP(8)
               session cache.
 
        <b><a href="postconf.5.html#smtp_tls_session_cache_timeout">smtp_tls_session_cache_timeout</a> (3600s)</b>
-              The expiration time of Postfix SMTP  client  TLS  session  cache
+              The  expiration  time  of  Postfix SMTP client TLS session cache
               information.
 
        <b><a href="postconf.5.html#smtp_tls_verify_cert_match">smtp_tls_verify_cert_match</a> (hostname)</b>
-              How  the  Postfix  SMTP  client  verifies the server certificate
+              How the Postfix SMTP  client  verifies  the  server  certificate
               peername for the "verify" TLS security level.
 
        <b><a href="postconf.5.html#tls_daemon_random_bytes">tls_daemon_random_bytes</a> (32)</b>
-              The number of pseudo-random bytes that an  <a href="smtp.8.html"><b>smtp</b>(8)</a>  or  <a href="smtpd.8.html"><b>smtpd</b>(8)</a>
-              process  requests from the <a href="tlsmgr.8.html"><b>tlsmgr</b>(8)</a> server in order to seed its
+              The  number  of  pseudo-random bytes that an <a href="smtp.8.html"><b>smtp</b>(8)</a> or <a href="smtpd.8.html"><b>smtpd</b>(8)</a>
+              process requests from the <a href="tlsmgr.8.html"><b>tlsmgr</b>(8)</a> server in order to seed  its
               internal pseudo random number generator (PRNG).
 
        <b><a href="postconf.5.html#tls_high_cipherlist">tls_high_cipherlist</a> (see 'postconf -d' output)</b>
@@ -561,52 +576,52 @@ SMTP(8)                                                                SMTP(8)
               The OpenSSL cipherlist for "export" or higher grade ciphers.
 
        <b><a href="postconf.5.html#tls_null_cipherlist">tls_null_cipherlist</a> (eNULL:!aNULL)</b>
-              The OpenSSL cipherlist for "NULL"  grade  ciphers  that  provide
+              The  OpenSSL  cipherlist  for  "NULL" grade ciphers that provide
               authentication without encryption.
 
        Available in Postfix version 2.4 and later:
 
        <b><a href="postconf.5.html#smtp_sasl_tls_verified_security_options">smtp_sasl_tls_verified_security_options</a>           ($<a href="postconf.5.html#smtp_sasl_tls_security_options">smtp_sasl_tls_secu</a>-</b>
        <b><a href="postconf.5.html#smtp_sasl_tls_security_options">rity_options</a>)</b>
-              The  SASL  authentication security options that the Postfix SMTP
-              client uses for TLS encrypted  SMTP  sessions  with  a  verified
+              The SASL authentication security options that the  Postfix  SMTP
+              client  uses  for  TLS  encrypted  SMTP sessions with a verified
               server certificate.
 
        Available in Postfix version 2.5 and later:
 
        <b><a href="postconf.5.html#smtp_tls_fingerprint_cert_match">smtp_tls_fingerprint_cert_match</a> (empty)</b>
-              List  of  acceptable remote SMTP server certificate fingerprints
-              for  the  "fingerprint"  TLS  security   level   (<b><a href="postconf.5.html#smtp_tls_security_level">smtp_tls_secu</a>-</b>
+              List of acceptable remote SMTP server  certificate  fingerprints
+              for   the   "fingerprint"  TLS  security  level  (<b><a href="postconf.5.html#smtp_tls_security_level">smtp_tls_secu</a>-</b>
               <b><a href="postconf.5.html#smtp_tls_security_level">rity_level</a></b> = fingerprint).
 
        <b><a href="postconf.5.html#smtp_tls_fingerprint_digest">smtp_tls_fingerprint_digest</a> (see 'postconf -d' output)</b>
-              The  message  digest  algorithm  used  to  construct remote SMTP
+              The message digest  algorithm  used  to  construct  remote  SMTP
               server certificate fingerprints.
 
        Available in Postfix version 2.6 and later:
 
        <b><a href="postconf.5.html#smtp_tls_protocols">smtp_tls_protocols</a> (see postconf -d output)</b>
-              TLS protocols that the Postfix SMTP client will use with  oppor-
+              TLS  protocols that the Postfix SMTP client will use with oppor-
               tunistic TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_ciphers">smtp_tls_ciphers</a> (medium)</b>
-              The  minimum  TLS cipher grade that the Postfix SMTP client will
+              The minimum TLS cipher grade that the Postfix SMTP  client  will
               use with opportunistic TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_eccert_file">smtp_tls_eccert_file</a> (empty)</b>
-              File with the Postfix SMTP client ECDSA certificate in PEM  for-
+              File  with the Postfix SMTP client ECDSA certificate in PEM for-
               mat.
 
        <b><a href="postconf.5.html#smtp_tls_eckey_file">smtp_tls_eckey_file</a> ($<a href="postconf.5.html#smtp_tls_eccert_file">smtp_tls_eccert_file</a>)</b>
-              File  with the Postfix SMTP client ECDSA private key in PEM for-
+              File with the Postfix SMTP client ECDSA private key in PEM  for-
               mat.
 
        Available in Postfix version 2.7 and later:
 
        <b><a href="postconf.5.html#smtp_tls_block_early_mail_reply">smtp_tls_block_early_mail_reply</a> (no)</b>
-              Try to detect a mail hijacking attack based on  a  TLS  protocol
-              vulnerability  (CVE-2009-3555), where an attacker prepends mali-
-              cious HELO, MAIL, RCPT, DATA commands to a Postfix  SMTP  client
+              Try  to  detect  a mail hijacking attack based on a TLS protocol
+              vulnerability (CVE-2009-3555), where an attacker prepends  mali-
+              cious  HELO,  MAIL, RCPT, DATA commands to a Postfix SMTP client
               TLS session.
 
        Available in Postfix version 2.8 and later:
@@ -626,11 +641,11 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.11 and later:
 
        <b><a href="postconf.5.html#smtp_tls_trust_anchor_file">smtp_tls_trust_anchor_file</a> (empty)</b>
-              Zero or more PEM-format  files  with  trust-anchor  certificates
+              Zero  or  more  PEM-format  files with trust-anchor certificates
               and/or public keys.
 
        <b><a href="postconf.5.html#smtp_tls_force_insecure_host_tlsa_lookup">smtp_tls_force_insecure_host_tlsa_lookup</a> (no)</b>
-              Lookup  the  associated  DANE TLSA RRset even when a hostname is
+              Lookup the associated DANE TLSA RRset even when  a  hostname  is
               not an alias and its address records lie in an unsigned zone.
 
        <b><a href="postconf.5.html#tlsmgr_service_name">tlsmgr_service_name</a> (tlsmgr)</b>
@@ -639,14 +654,14 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 3.0 and later:
 
        <b><a href="postconf.5.html#smtp_tls_wrappermode">smtp_tls_wrappermode</a> (no)</b>
-              Request that the Postfix SMTP client connects using  the  legacy
+              Request  that  the Postfix SMTP client connects using the legacy
               SMTPS protocol instead of using the STARTTLS command.
 
        Available in Postfix version 3.1 and later:
 
        <b><a href="postconf.5.html#smtp_tls_dane_insecure_mx_policy">smtp_tls_dane_insecure_mx_policy</a> (see 'postconf -d' output)</b>
-              The  TLS policy for MX hosts with "secure" TLSA records when the
-              nexthop destination security level is <b>dane</b>, but  the  MX  record
+              The TLS policy for MX hosts with "secure" TLSA records when  the
+              nexthop  destination  security  level is <b>dane</b>, but the MX record
               was found via an "insecure" MX lookup.
 
        Available in Postfix version 3.4 and later:
@@ -655,54 +670,54 @@ SMTP(8)                                                                SMTP(8)
               Try to make multiple deliveries per TLS-encrypted connection.
 
        <b><a href="postconf.5.html#smtp_tls_chain_files">smtp_tls_chain_files</a> (empty)</b>
-              List  of one or more PEM files, each holding one or more private
+              List of one or more PEM files, each holding one or more  private
               keys directly followed by a corresponding certificate chain.
 
        <b><a href="postconf.5.html#smtp_tls_servername">smtp_tls_servername</a> (empty)</b>
-              Optional name to send to the  remote  SMTP  server  in  the  TLS
+              Optional  name  to  send  to  the  remote SMTP server in the TLS
               Server Name Indication (SNI) extension.
 
        Available in Postfix 3.5, 3.4.6, 3.3.5, 3.2.10, 3.1.13 and later:
 
        <b><a href="postconf.5.html#tls_fast_shutdown_enable">tls_fast_shutdown_enable</a> (yes)</b>
-              A  workaround  for implementations that hang Postfix while shut-
+              A workaround for implementations that hang Postfix  while  shut-
               ting down a TLS session, until Postfix times out.
 
 <b>OBSOLETE STARTTLS CONTROLS</b>
-       The following configuration parameters  exist  for  compatibility  with
-       Postfix  versions  before  2.3.  Support for these will be removed in a
+       The  following  configuration  parameters  exist for compatibility with
+       Postfix versions before 2.3. Support for these will  be  removed  in  a
        future release.
 
        <b><a href="postconf.5.html#smtp_use_tls">smtp_use_tls</a> (no)</b>
-              Opportunistic mode: use TLS when a remote SMTP server  announces
+              Opportunistic  mode: use TLS when a remote SMTP server announces
               STARTTLS support, otherwise send the mail in the clear.
 
        <b><a href="postconf.5.html#smtp_enforce_tls">smtp_enforce_tls</a> (no)</b>
-              Enforcement  mode:  require  that  remote  SMTP  servers use TLS
+              Enforcement mode: require  that  remote  SMTP  servers  use  TLS
               encryption, and never send mail in the clear.
 
        <b><a href="postconf.5.html#smtp_tls_enforce_peername">smtp_tls_enforce_peername</a> (yes)</b>
-              With mandatory TLS encryption,  require  that  the  remote  SMTP
-              server  hostname  matches  the  information  in  the remote SMTP
+              With  mandatory  TLS  encryption,  require  that the remote SMTP
+              server hostname matches  the  information  in  the  remote  SMTP
               server certificate.
 
        <b><a href="postconf.5.html#smtp_tls_per_site">smtp_tls_per_site</a> (empty)</b>
-              Optional lookup tables with the Postfix SMTP  client  TLS  usage
-              policy  by  next-hop destination and by remote SMTP server host-
+              Optional  lookup  tables  with the Postfix SMTP client TLS usage
+              policy by next-hop destination and by remote SMTP  server  host-
               name.
 
        <b><a href="postconf.5.html#smtp_tls_cipherlist">smtp_tls_cipherlist</a> (empty)</b>
-              Obsolete Postfix &lt; 2.3 control for the Postfix SMTP  client  TLS
+              Obsolete  Postfix  &lt; 2.3 control for the Postfix SMTP client TLS
               cipher list.
 
 <b>RESOURCE AND RATE CONTROLS</b>
        <b><a href="postconf.5.html#smtp_connect_timeout">smtp_connect_timeout</a> (30s)</b>
-              The  Postfix SMTP client time limit for completing a TCP connec-
+              The Postfix SMTP client time limit for completing a TCP  connec-
               tion, or zero (use the operating system built-in time limit).
 
        <b><a href="postconf.5.html#smtp_helo_timeout">smtp_helo_timeout</a> (300s)</b>
-              The Postfix SMTP client time limit for sending the HELO or  EHLO
-              command,  and  for  receiving  the  initial  remote  SMTP server
+              The  Postfix SMTP client time limit for sending the HELO or EHLO
+              command, and  for  receiving  the  initial  remote  SMTP  server
               response.
 
        <b><a href="postconf.5.html#lmtp_lhlo_timeout">lmtp_lhlo_timeout</a> (300s)</b>
@@ -714,19 +729,19 @@ SMTP(8)                                                                SMTP(8)
               mand, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_mail_timeout">smtp_mail_timeout</a> (300s)</b>
-              The Postfix SMTP client time limit for  sending  the  MAIL  FROM
+              The  Postfix  SMTP  client  time limit for sending the MAIL FROM
               command, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_rcpt_timeout">smtp_rcpt_timeout</a> (300s)</b>
-              The  Postfix SMTP client time limit for sending the SMTP RCPT TO
+              The Postfix SMTP client time limit for sending the SMTP RCPT  TO
               command, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_data_init_timeout">smtp_data_init_timeout</a> (120s)</b>
-              The Postfix SMTP client time limit for  sending  the  SMTP  DATA
+              The  Postfix  SMTP  client  time limit for sending the SMTP DATA
               command, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_data_xfer_timeout">smtp_data_xfer_timeout</a> (180s)</b>
-              The  Postfix SMTP client time limit for sending the SMTP message
+              The Postfix SMTP client time limit for sending the SMTP  message
               content.
 
        <b><a href="postconf.5.html#smtp_data_done_timeout">smtp_data_done_timeout</a> (600s)</b>
@@ -740,13 +755,13 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.1 and later:
 
        <b><a href="postconf.5.html#smtp_mx_address_limit">smtp_mx_address_limit</a> (5)</b>
-              The maximal number of MX (mail exchanger) IP addresses that  can
-              result  from Postfix SMTP client mail exchanger lookups, or zero
+              The  maximal number of MX (mail exchanger) IP addresses that can
+              result from Postfix SMTP client mail exchanger lookups, or  zero
               (no limit).
 
        <b><a href="postconf.5.html#smtp_mx_session_limit">smtp_mx_session_limit</a> (2)</b>
-              The maximal number of SMTP sessions per delivery request  before
-              the  Postfix  SMTP  client  gives  up or delivers to a fall-back
+              The  maximal number of SMTP sessions per delivery request before
+              the Postfix SMTP client gives up  or  delivers  to  a  fall-back
               <a href="postconf.5.html#relayhost">relay host</a>, or zero (no limit).
 
        <b><a href="postconf.5.html#smtp_rset_timeout">smtp_rset_timeout</a> (20s)</b>
@@ -756,17 +771,17 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.2 and earlier:
 
        <b><a href="postconf.5.html#lmtp_cache_connection">lmtp_cache_connection</a> (yes)</b>
-              Keep  Postfix  LMTP  client connections open for up to $<a href="postconf.5.html#max_idle">max_idle</a>
+              Keep Postfix LMTP client connections open for  up  to  $<a href="postconf.5.html#max_idle">max_idle</a>
               seconds.
 
        Available in Postfix version 2.2 and later:
 
        <b><a href="postconf.5.html#smtp_connection_cache_destinations">smtp_connection_cache_destinations</a> (empty)</b>
-              Permanently enable SMTP connection  caching  for  the  specified
+              Permanently  enable  SMTP  connection  caching for the specified
               destinations.
 
        <b><a href="postconf.5.html#smtp_connection_cache_on_demand">smtp_connection_cache_on_demand</a> (yes)</b>
-              Temporarily  enable  SMTP connection caching while a destination
+              Temporarily enable SMTP connection caching while  a  destination
               has a high volume of mail in the <a href="QSHAPE_README.html#active_queue">active queue</a>.
 
        <b><a href="postconf.5.html#smtp_connection_reuse_time_limit">smtp_connection_reuse_time_limit</a> (300s)</b>
@@ -780,23 +795,23 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.3 and later:
 
        <b><a href="postconf.5.html#connection_cache_protocol_timeout">connection_cache_protocol_timeout</a> (5s)</b>
-              Time limit for connection cache connect, send or receive  opera-
+              Time  limit for connection cache connect, send or receive opera-
               tions.
 
-       Available in Postfix version 2.9 and later:
+       Available in Postfix version 2.9 - 3.6:
 
        <b><a href="postconf.5.html#smtp_per_record_deadline">smtp_per_record_deadline</a> (no)</b>
-              Change  the  behavior  of the smtp_*_timeout time limits, from a
-              time limit per read or write system call, to  a  time  limit  to
-              send  or  receive  a complete record (an SMTP command line, SMTP
-              response line, SMTP message content line, or TLS  protocol  mes-
+              Change the behavior of the smtp_*_timeout time  limits,  from  a
+              time  limit  per  read  or write system call, to a time limit to
+              send or receive a complete record (an SMTP  command  line,  SMTP
+              response  line,  SMTP message content line, or TLS protocol mes-
               sage).
 
        Available in Postfix version 2.11 and later:
 
        <b><a href="postconf.5.html#smtp_connection_reuse_count_limit">smtp_connection_reuse_count_limit</a> (0)</b>
-              When  SMTP  connection  caching  is enabled, the number of times
-              that an SMTP session may be reused before it is closed, or  zero
+              When SMTP connection caching is enabled,  the  number  of  times
+              that  an SMTP session may be reused before it is closed, or zero
               (no limit).
 
        Available in Postfix version 3.4 and later:
@@ -804,6 +819,19 @@ SMTP(8)                                                                SMTP(8)
        <b><a href="postconf.5.html#smtp_tls_connection_reuse">smtp_tls_connection_reuse</a> (no)</b>
               Try to make multiple deliveries per TLS-encrypted connection.
 
+       Available in Postfix version 3.7 and later:
+
+       <b><a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a> (no)</b>
+              Change the behavior of the smtp_*_timeout time  limits,  from  a
+              time  limit  per  plaintext or TLS read or write call, to a com-
+              bined time limit for sending a complete  SMTP  request  and  for
+              receiving a complete SMTP response.
+
+       <b><a href="postconf.5.html#smtp_min_data_rate">smtp_min_data_rate</a> (500)</b>
+              The  minimum  plaintext  data  transfer rate in bytes/second for
+              DATA    requests,    when    deadlines    are    enabled    with
+              <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>.
+
        Implemented in the <a href="qmgr.8.html">qmgr(8)</a> daemon:
 
        <b>transport_destination_concurrency_limit   ($<a href="postconf.5.html#default_destination_concurrency_limit">default_destination_concur</a>-</b>
index 64de53cd1406a09335e7bb4830280cae5e178f4a..35acee727da95b491c6f86104a5c948fdca36290 100644 (file)
@@ -4914,6 +4914,17 @@ configuration parameter. See there for details. </p>
 <p> This feature is available in Postfix 2.5 and later. </p>
 
 
+</DD>
+
+<DT><b><a name="lmtp_min_data_rate">lmtp_min_data_rate</a>
+(default: 500)</b></DT><DD>
+
+<p> The LMTP-specific version of the <a href="postconf.5.html#smtp_min_data_rate">smtp_min_data_rate</a> configuration
+parameter. See there for details. </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+
 </DD>
 
 <DT><b><a name="lmtp_mx_address_limit">lmtp_mx_address_limit</a>
@@ -4958,6 +4969,17 @@ configuration parameter.  See there for details. </p>
 <p> This feature is available in Postfix 2.9 and later.  </p>
 
 
+</DD>
+
+<DT><b><a name="lmtp_per_request_deadline">lmtp_per_request_deadline</a>
+(default: no)</b></DT><DD>
+
+<p> The LMTP-specific version of the <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>
+configuration parameter. See there for details. </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+
 </DD>
 
 <DT><b><a name="lmtp_pix_workaround_delay_time">lmtp_pix_workaround_delay_time</a>
@@ -11581,6 +11603,23 @@ available.  </p>
 <p> This feature is available in Postfix 2.5 and later. </p>
 
 
+</DD>
+
+<DT><b><a name="smtp_min_data_rate">smtp_min_data_rate</a>
+(default: 500)</b></DT><DD>
+
+<p> The minimum plaintext data transfer rate in bytes/second for
+DATA requests, when deadlines are enabled with <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>.
+After a write operation transfers N plaintext message bytes (possibly
+after TLS encryption), and after the DATA request deadline is
+decremented by the elapsed time of that write operation, the DATA
+request deadline is incremented by N/smtp_min_data_rate seconds.
+However, the deadline will never be incremented beyond the time
+limit specified with <a href="postconf.5.html#smtp_data_xfer_timeout">smtp_data_xfer_timeout</a>.  </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+
 </DD>
 
 <DT><b><a name="smtp_mx_address_limit">smtp_mx_address_limit</a>
@@ -11653,9 +11692,38 @@ The reasons are that a TLS protocol message can be up to 16 kbytes
 long (with TLSv1), and that an entire TLS protocol message must be
 sent or received within the per-record deadline.  </p>
 
-<p> This feature is available in Postfix 2.9 and later. With older
+<p> This feature is available in Postfix 2.9-3.6. With older
 Postfix releases, the behavior is as if this parameter is set to
-"no". </p>
+"no". Postfix 3.7 and later use <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>. </p>
+
+
+</DD>
+
+<DT><b><a name="smtp_per_request_deadline">smtp_per_request_deadline</a>
+(default: no)</b></DT><DD>
+
+<p> Change the behavior of the smtp_*_timeout time limits, from a
+time limit per plaintext or TLS read or write call, to a combined
+time limit for sending a complete SMTP request and for receiving a
+complete SMTP response. The deadline limits only the time spent
+waiting for plaintext or TLS read or write calls, not time spent
+elsewhere. The per-request deadline limits the impact from hostile
+peers that trickle data one byte at a time. </p>
+
+<p> See <a href="postconf.5.html#smtp_min_data_rate">smtp_min_data_rate</a> for how the per-request deadline is
+managed during the DATA phase. </p>
+
+<p> Note: when per-request deadlines are enabled, a short time limit
+may cause problems with TLS over very slow network connections. The
+reason is that a TLS protocol message can be up to 16 kbytes long
+(with TLSv1), and that an entire TLS protocol message must be
+transferred within the per-request deadline. </p>
+
+<p> This feature is available in Postfix 3.7 and later. A weaker
+feature, called <a href="postconf.5.html#smtp_per_record_deadline">smtp_per_record_deadline</a>, is available with Postfix
+2.9-3.6. </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
 
 
 </DD>
@@ -15627,6 +15695,24 @@ separator. See the <a href="MILTER_README.html">MILTER_README</a> document for d
 <p> This feature is available in Postfix 2.3 and later. </p>
 
 
+</DD>
+
+<DT><b><a name="smtpd_min_data_rate">smtpd_min_data_rate</a>
+(default: 500)</b></DT><DD>
+
+<p> The minimum plaintext data transfer rate in bytes/second for
+DATA and BDAT requests, when deadlines are enabled with
+<a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a>. After a read operation transfers N
+plaintext message bytes (possibly after TLS decryption), and after
+the DATA or BDAT request deadline is decremented by the elapsed
+time of that read operation, the DATA or BDAT request deadline is
+incremented by N/smtpd_min_data_rate seconds. However, the deadline
+will never be incremented beyond the time limit specified with
+<a href="postconf.5.html#smtpd_timeout">smtpd_timeout</a>.  </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+
 </DD>
 
 <DT><b><a name="smtpd_noop_commands">smtpd_noop_commands</a>
@@ -15683,9 +15769,39 @@ The reasons are that a TLS protocol message can be up to 16 kbytes
 long (with TLSv1), and that an entire TLS protocol message must be
 sent or received within the per-record deadline.  </p>
 
-<p> This feature is available in Postfix 2.9 and later. With older
+<p> This feature is available in Postfix 2.9-3.6. With older
 Postfix releases, the behavior is as if this parameter is set to
-"no". </p>
+"no". Postfix 3.7 and later use <a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a>. </p>
+
+
+</DD>
+
+<DT><b><a name="smtpd_per_request_deadline">smtpd_per_request_deadline</a>
+(default: normal: no, overload: yes)</b></DT><DD>
+
+<p> Change the behavior of the <a href="postconf.5.html#smtpd_timeout">smtpd_timeout</a> and <a href="postconf.5.html#smtpd_starttls_timeout">smtpd_starttls_timeout</a>
+time limits, from a time limit per plaintext or TLS read or write
+call, to a combined time limit for receiving a complete SMTP request
+and for sending a complete SMTP response. The deadline limits only
+the time spent waiting for plaintext or TLS read or write calls,
+not time spent elsewhere. The per-request deadline limits the impact
+from hostile peers that trickle data one byte at a time. </p>
+
+<p> See <a href="postconf.5.html#smtpd_min_data_rate">smtpd_min_data_rate</a> for how the per-request deadline is
+managed during the DATA and BDAT phase. </p>
+
+<p> Note: when per-request deadlines are enabled, a short time limit
+may cause problems with TLS over very slow network connections. The
+reason is that a TLS protocol message can be up to 16 kbytes long
+(with TLSv1), and that an entire TLS protocol message must be
+transferred within the per-request deadline. </p>
+
+<p> This feature is available in Postfix 3.7 and later. A weaker
+feature, called <a href="postconf.5.html#smtpd_per_record_deadline">smtpd_per_record_deadline</a>, is available with Postfix
+2.9-3.6. With older Postfix releases, the behavior is as if this
+parameter is set to "no". </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
 
 
 </DD>
@@ -17075,8 +17191,9 @@ response, how long the Postfix SMTP server will wait for an underlying
 network write operation to complete; and when the Postfix SMTP
 server Postfix wants to receive an SMTP client request, how long
 the Postfix SMTP server will wait for an underlying network read
-operation to complete. See <a href="postconf.5.html#smtpd_per_record_deadline">smtpd_per_record_deadline</a> for how this
-time limit may be enforced. </p>
+operation to complete. See the <a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a> for how
+this time limit may be enforced (with Postfix 2.9-3.6 see
+<a href="postconf.5.html#smtpd_per_record_deadline">smtpd_per_record_deadline</a>). </p>
 
 <p> Normally the default limit
 is 300s, but it changes under overload to just 10s. With Postfix
index f8bde52a3fa3efb4ffb75e84aae450c3a39a3282..2f654e0a633de87ea943c9046f86b918dcb4526d 100644 (file)
@@ -324,7 +324,7 @@ SMTP(8)                                                                SMTP(8)
        <b><a href="postconf.5.html#smtp_dns_resolver_options">smtp_dns_resolver_options</a> (empty)</b>
               DNS Resolver options for the Postfix SMTP client.
 
-       Available in Postfix version 2.9 and later:
+       Available in Postfix version 2.9 - 3.6:
 
        <b><a href="postconf.5.html#smtp_per_record_deadline">smtp_per_record_deadline</a> (no)</b>
               Change the behavior of the smtp_*_timeout time  limits,  from  a
@@ -333,6 +333,8 @@ SMTP(8)                                                                SMTP(8)
               response  line,  SMTP message content line, or TLS protocol mes-
               sage).
 
+       Available in Postfix version 2.9 and later:
+
        <b><a href="postconf.5.html#smtp_send_dummy_mail_auth">smtp_send_dummy_mail_auth</a> (no)</b>
               Whether or not to append the "AUTH=&lt;&gt;" option to the  MAIL  FROM
               command in SASL-authenticated SMTP sessions.
@@ -372,11 +374,24 @@ SMTP(8)                                                                SMTP(8)
               ".") that Postfix may use to determine whether DNSSEC validation
               is available.
 
-       <b>known_tcp_ports  (lmtp=24,  smtp=25,   smtps=submissions=465,   submis-</b>
+       <b><a href="postconf.5.html#known_tcp_ports">known_tcp_ports</a>  (lmtp=24,  smtp=25,   smtps=submissions=465,   submis-</b>
        <b>sion=587)</b>
               Optional setting that avoids lookups in  the  <b>services</b>(5)  data-
               base.
 
+       Available in Postfix version 3.7 and later:
+
+       <b><a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a> (no)</b>
+              Change  the  behavior  of the smtp_*_timeout time limits, from a
+              time limit per plaintext or TLS read or write call,  to  a  com-
+              bined  time  limit  for  sending a complete SMTP request and for
+              receiving a complete SMTP response.
+
+       <b><a href="postconf.5.html#smtp_min_data_rate">smtp_min_data_rate</a> (500)</b>
+              The minimum plaintext data transfer  rate  in  bytes/second  for
+              DATA    requests,    when    deadlines    are    enabled    with
+              <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>.
+
 <b>MIME PROCESSING CONTROLS</b>
        Available in Postfix version 2.0 and later:
 
@@ -393,7 +408,7 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.1 and later:
 
        <b><a href="postconf.5.html#smtp_send_xforward_command">smtp_send_xforward_command</a> (no)</b>
-              Send the non-standard XFORWARD command  when  the  Postfix  SMTP
+              Send  the  non-standard  XFORWARD  command when the Postfix SMTP
               server EHLO response announces XFORWARD support.
 
 <b>SASL AUTHENTICATION CONTROLS</b>
@@ -401,62 +416,62 @@ SMTP(8)                                                                SMTP(8)
               Enable SASL authentication in the Postfix SMTP client.
 
        <b><a href="postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps</a> (empty)</b>
-              Optional  Postfix  SMTP  client  lookup  tables  with  one user-
-              name:password entry per  sender,  remote  hostname  or  next-hop
+              Optional Postfix  SMTP  client  lookup  tables  with  one  user-
+              name:password  entry  per  sender,  remote  hostname or next-hop
               domain.
 
        <b><a href="postconf.5.html#smtp_sasl_security_options">smtp_sasl_security_options</a> (noplaintext, noanonymous)</b>
               Postfix SMTP client SASL security options; as of Postfix 2.3 the
-              list of available features depends on the SASL client  implemen-
+              list  of available features depends on the SASL client implemen-
               tation that is selected with <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a></b>.
 
        Available in Postfix version 2.2 and later:
 
        <b><a href="postconf.5.html#smtp_sasl_mechanism_filter">smtp_sasl_mechanism_filter</a> (empty)</b>
-              If  non-empty,  a Postfix SMTP client filter for the remote SMTP
+              If non-empty, a Postfix SMTP client filter for the  remote  SMTP
               server's list of offered SASL mechanisms.
 
        Available in Postfix version 2.3 and later:
 
        <b><a href="postconf.5.html#smtp_sender_dependent_authentication">smtp_sender_dependent_authentication</a> (no)</b>
               Enable  sender-dependent  authentication  in  the  Postfix  SMTP
-              client;  this  is  available  only with SASL authentication, and
-              disables SMTP connection caching to ensure that mail  from  dif-
+              client; this is available only  with  SASL  authentication,  and
+              disables  SMTP  connection caching to ensure that mail from dif-
               ferent senders will use the appropriate credentials.
 
        <b><a href="postconf.5.html#smtp_sasl_path">smtp_sasl_path</a> (empty)</b>
               Implementation-specific information that the Postfix SMTP client
-              passes through  to  the  SASL  plug-in  implementation  that  is
+              passes  through  to  the  SASL  plug-in  implementation  that is
               selected with <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a></b>.
 
        <b><a href="postconf.5.html#smtp_sasl_type">smtp_sasl_type</a> (cyrus)</b>
-              The  SASL  plug-in  type that the Postfix SMTP client should use
+              The SASL plug-in type that the Postfix SMTP  client  should  use
               for authentication.
 
        Available in Postfix version 2.5 and later:
 
        <b><a href="postconf.5.html#smtp_sasl_auth_cache_name">smtp_sasl_auth_cache_name</a> (empty)</b>
-              An optional table to prevent repeated SASL authentication  fail-
-              ures  with  the  same  remote SMTP server hostname, username and
+              An  optional table to prevent repeated SASL authentication fail-
+              ures with the same remote SMTP  server  hostname,  username  and
               password.
 
        <b><a href="postconf.5.html#smtp_sasl_auth_cache_time">smtp_sasl_auth_cache_time</a> (90d)</b>
-              The maximal age of an <a href="postconf.5.html#smtp_sasl_auth_cache_name">smtp_sasl_auth_cache_name</a> entry before  it
+              The  maximal age of an <a href="postconf.5.html#smtp_sasl_auth_cache_name">smtp_sasl_auth_cache_name</a> entry before it
               is removed.
 
        <b><a href="postconf.5.html#smtp_sasl_auth_soft_bounce">smtp_sasl_auth_soft_bounce</a> (yes)</b>
-              When  a remote SMTP server rejects a SASL authentication request
-              with a 535 reply code, defer mail delivery instead of  returning
+              When a remote SMTP server rejects a SASL authentication  request
+              with  a 535 reply code, defer mail delivery instead of returning
               mail as undeliverable.
 
        Available in Postfix version 2.9 and later:
 
        <b><a href="postconf.5.html#smtp_send_dummy_mail_auth">smtp_send_dummy_mail_auth</a> (no)</b>
-              Whether  or  not to append the "AUTH=&lt;&gt;" option to the MAIL FROM
+              Whether or not to append the "AUTH=&lt;&gt;" option to the  MAIL  FROM
               command in SASL-authenticated SMTP sessions.
 
 <b>STARTTLS SUPPORT CONTROLS</b>
-       Detailed information about STARTTLS configuration may be found  in  the
+       Detailed  information  about STARTTLS configuration may be found in the
        <a href="TLS_README.html">TLS_README</a> document.
 
        <b><a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a> (empty)</b>
@@ -466,20 +481,20 @@ SMTP(8)                                                                SMTP(8)
               <a href="postconf.5.html#smtp_tls_enforce_peername">smtp_tls_enforce_peername</a>.
 
        <b><a href="postconf.5.html#smtp_sasl_tls_security_options">smtp_sasl_tls_security_options</a> ($<a href="postconf.5.html#smtp_sasl_security_options">smtp_sasl_security_options</a>)</b>
-              The SASL authentication security options that the  Postfix  SMTP
+              The  SASL  authentication security options that the Postfix SMTP
               client uses for TLS encrypted SMTP sessions.
 
        <b><a href="postconf.5.html#smtp_starttls_timeout">smtp_starttls_timeout</a> (300s)</b>
-              Time  limit  for  Postfix  SMTP client write and read operations
+              Time limit for Postfix SMTP client  write  and  read  operations
               during TLS startup and shutdown handshake procedures.
 
        <b><a href="postconf.5.html#smtp_tls_CAfile">smtp_tls_CAfile</a> (empty)</b>
-              A file containing CA certificates of root CAs  trusted  to  sign
-              either  remote  SMTP server certificates or intermediate CA cer-
+              A  file  containing  CA certificates of root CAs trusted to sign
+              either remote SMTP server certificates or intermediate  CA  cer-
               tificates.
 
        <b><a href="postconf.5.html#smtp_tls_CApath">smtp_tls_CApath</a> (empty)</b>
-              Directory with PEM format Certification  Authority  certificates
+              Directory  with  PEM format Certification Authority certificates
               that the Postfix SMTP client uses to verify a remote SMTP server
               certificate.
 
@@ -487,7 +502,7 @@ SMTP(8)                                                                SMTP(8)
               File with the Postfix SMTP client RSA certificate in PEM format.
 
        <b><a href="postconf.5.html#smtp_tls_mandatory_ciphers">smtp_tls_mandatory_ciphers</a> (medium)</b>
-              The  minimum  TLS cipher grade that the Postfix SMTP client will
+              The minimum TLS cipher grade that the Postfix SMTP  client  will
               use with mandatory TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_exclude_ciphers">smtp_tls_exclude_ciphers</a> (empty)</b>
@@ -495,8 +510,8 @@ SMTP(8)                                                                SMTP(8)
               client cipher list at all TLS security levels.
 
        <b><a href="postconf.5.html#smtp_tls_mandatory_exclude_ciphers">smtp_tls_mandatory_exclude_ciphers</a> (empty)</b>
-              Additional  list  of ciphers or cipher types to exclude from the
-              Postfix SMTP client cipher list at mandatory TLS  security  lev-
+              Additional list of ciphers or cipher types to exclude  from  the
+              Postfix  SMTP  client cipher list at mandatory TLS security lev-
               els.
 
        <b><a href="postconf.5.html#smtp_tls_dcert_file">smtp_tls_dcert_file</a> (empty)</b>
@@ -512,7 +527,7 @@ SMTP(8)                                                                SMTP(8)
               Enable additional Postfix SMTP client logging of TLS activity.
 
        <b><a href="postconf.5.html#smtp_tls_note_starttls_offer">smtp_tls_note_starttls_offer</a> (no)</b>
-              Log the hostname of a remote SMTP server that  offers  STARTTLS,
+              Log  the  hostname of a remote SMTP server that offers STARTTLS,
               when TLS is not already enabled for that server.
 
        <b><a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a> (empty)</b>
@@ -521,14 +536,14 @@ SMTP(8)                                                                SMTP(8)
               fied, this overrides the obsolete <a href="postconf.5.html#smtp_tls_per_site">smtp_tls_per_site</a> parameter.
 
        <b><a href="postconf.5.html#smtp_tls_mandatory_protocols">smtp_tls_mandatory_protocols</a> (see 'postconf -d' output)</b>
-              TLS  protocols that the Postfix SMTP client will use with manda-
+              TLS protocols that the Postfix SMTP client will use with  manda-
               tory TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_scert_verifydepth">smtp_tls_scert_verifydepth</a> (9)</b>
               The verification depth for remote SMTP server certificates.
 
        <b><a href="postconf.5.html#smtp_tls_secure_cert_match">smtp_tls_secure_cert_match</a> (nexthop, dot-nexthop)</b>
-              How the Postfix SMTP  client  verifies  the  server  certificate
+              How  the  Postfix  SMTP  client  verifies the server certificate
               peername for the "secure" TLS security level.
 
        <b><a href="postconf.5.html#smtp_tls_session_cache_database">smtp_tls_session_cache_database</a> (empty)</b>
@@ -536,16 +551,16 @@ SMTP(8)                                                                SMTP(8)
               session cache.
 
        <b><a href="postconf.5.html#smtp_tls_session_cache_timeout">smtp_tls_session_cache_timeout</a> (3600s)</b>
-              The expiration time of Postfix SMTP  client  TLS  session  cache
+              The  expiration  time  of  Postfix SMTP client TLS session cache
               information.
 
        <b><a href="postconf.5.html#smtp_tls_verify_cert_match">smtp_tls_verify_cert_match</a> (hostname)</b>
-              How  the  Postfix  SMTP  client  verifies the server certificate
+              How the Postfix SMTP  client  verifies  the  server  certificate
               peername for the "verify" TLS security level.
 
        <b><a href="postconf.5.html#tls_daemon_random_bytes">tls_daemon_random_bytes</a> (32)</b>
-              The number of pseudo-random bytes that an  <a href="smtp.8.html"><b>smtp</b>(8)</a>  or  <a href="smtpd.8.html"><b>smtpd</b>(8)</a>
-              process  requests from the <a href="tlsmgr.8.html"><b>tlsmgr</b>(8)</a> server in order to seed its
+              The  number  of  pseudo-random bytes that an <a href="smtp.8.html"><b>smtp</b>(8)</a> or <a href="smtpd.8.html"><b>smtpd</b>(8)</a>
+              process requests from the <a href="tlsmgr.8.html"><b>tlsmgr</b>(8)</a> server in order to seed  its
               internal pseudo random number generator (PRNG).
 
        <b><a href="postconf.5.html#tls_high_cipherlist">tls_high_cipherlist</a> (see 'postconf -d' output)</b>
@@ -561,52 +576,52 @@ SMTP(8)                                                                SMTP(8)
               The OpenSSL cipherlist for "export" or higher grade ciphers.
 
        <b><a href="postconf.5.html#tls_null_cipherlist">tls_null_cipherlist</a> (eNULL:!aNULL)</b>
-              The OpenSSL cipherlist for "NULL"  grade  ciphers  that  provide
+              The  OpenSSL  cipherlist  for  "NULL" grade ciphers that provide
               authentication without encryption.
 
        Available in Postfix version 2.4 and later:
 
        <b><a href="postconf.5.html#smtp_sasl_tls_verified_security_options">smtp_sasl_tls_verified_security_options</a>           ($<a href="postconf.5.html#smtp_sasl_tls_security_options">smtp_sasl_tls_secu</a>-</b>
        <b><a href="postconf.5.html#smtp_sasl_tls_security_options">rity_options</a>)</b>
-              The  SASL  authentication security options that the Postfix SMTP
-              client uses for TLS encrypted  SMTP  sessions  with  a  verified
+              The SASL authentication security options that the  Postfix  SMTP
+              client  uses  for  TLS  encrypted  SMTP sessions with a verified
               server certificate.
 
        Available in Postfix version 2.5 and later:
 
        <b><a href="postconf.5.html#smtp_tls_fingerprint_cert_match">smtp_tls_fingerprint_cert_match</a> (empty)</b>
-              List  of  acceptable remote SMTP server certificate fingerprints
-              for  the  "fingerprint"  TLS  security   level   (<b><a href="postconf.5.html#smtp_tls_security_level">smtp_tls_secu</a>-</b>
+              List of acceptable remote SMTP server  certificate  fingerprints
+              for   the   "fingerprint"  TLS  security  level  (<b><a href="postconf.5.html#smtp_tls_security_level">smtp_tls_secu</a>-</b>
               <b><a href="postconf.5.html#smtp_tls_security_level">rity_level</a></b> = fingerprint).
 
        <b><a href="postconf.5.html#smtp_tls_fingerprint_digest">smtp_tls_fingerprint_digest</a> (see 'postconf -d' output)</b>
-              The  message  digest  algorithm  used  to  construct remote SMTP
+              The message digest  algorithm  used  to  construct  remote  SMTP
               server certificate fingerprints.
 
        Available in Postfix version 2.6 and later:
 
        <b><a href="postconf.5.html#smtp_tls_protocols">smtp_tls_protocols</a> (see postconf -d output)</b>
-              TLS protocols that the Postfix SMTP client will use with  oppor-
+              TLS  protocols that the Postfix SMTP client will use with oppor-
               tunistic TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_ciphers">smtp_tls_ciphers</a> (medium)</b>
-              The  minimum  TLS cipher grade that the Postfix SMTP client will
+              The minimum TLS cipher grade that the Postfix SMTP  client  will
               use with opportunistic TLS encryption.
 
        <b><a href="postconf.5.html#smtp_tls_eccert_file">smtp_tls_eccert_file</a> (empty)</b>
-              File with the Postfix SMTP client ECDSA certificate in PEM  for-
+              File  with the Postfix SMTP client ECDSA certificate in PEM for-
               mat.
 
        <b><a href="postconf.5.html#smtp_tls_eckey_file">smtp_tls_eckey_file</a> ($<a href="postconf.5.html#smtp_tls_eccert_file">smtp_tls_eccert_file</a>)</b>
-              File  with the Postfix SMTP client ECDSA private key in PEM for-
+              File with the Postfix SMTP client ECDSA private key in PEM  for-
               mat.
 
        Available in Postfix version 2.7 and later:
 
        <b><a href="postconf.5.html#smtp_tls_block_early_mail_reply">smtp_tls_block_early_mail_reply</a> (no)</b>
-              Try to detect a mail hijacking attack based on  a  TLS  protocol
-              vulnerability  (CVE-2009-3555), where an attacker prepends mali-
-              cious HELO, MAIL, RCPT, DATA commands to a Postfix  SMTP  client
+              Try  to  detect  a mail hijacking attack based on a TLS protocol
+              vulnerability (CVE-2009-3555), where an attacker prepends  mali-
+              cious  HELO,  MAIL, RCPT, DATA commands to a Postfix SMTP client
               TLS session.
 
        Available in Postfix version 2.8 and later:
@@ -626,11 +641,11 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.11 and later:
 
        <b><a href="postconf.5.html#smtp_tls_trust_anchor_file">smtp_tls_trust_anchor_file</a> (empty)</b>
-              Zero or more PEM-format  files  with  trust-anchor  certificates
+              Zero  or  more  PEM-format  files with trust-anchor certificates
               and/or public keys.
 
        <b><a href="postconf.5.html#smtp_tls_force_insecure_host_tlsa_lookup">smtp_tls_force_insecure_host_tlsa_lookup</a> (no)</b>
-              Lookup  the  associated  DANE TLSA RRset even when a hostname is
+              Lookup the associated DANE TLSA RRset even when  a  hostname  is
               not an alias and its address records lie in an unsigned zone.
 
        <b><a href="postconf.5.html#tlsmgr_service_name">tlsmgr_service_name</a> (tlsmgr)</b>
@@ -639,14 +654,14 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 3.0 and later:
 
        <b><a href="postconf.5.html#smtp_tls_wrappermode">smtp_tls_wrappermode</a> (no)</b>
-              Request that the Postfix SMTP client connects using  the  legacy
+              Request  that  the Postfix SMTP client connects using the legacy
               SMTPS protocol instead of using the STARTTLS command.
 
        Available in Postfix version 3.1 and later:
 
        <b><a href="postconf.5.html#smtp_tls_dane_insecure_mx_policy">smtp_tls_dane_insecure_mx_policy</a> (see 'postconf -d' output)</b>
-              The  TLS policy for MX hosts with "secure" TLSA records when the
-              nexthop destination security level is <b>dane</b>, but  the  MX  record
+              The TLS policy for MX hosts with "secure" TLSA records when  the
+              nexthop  destination  security  level is <b>dane</b>, but the MX record
               was found via an "insecure" MX lookup.
 
        Available in Postfix version 3.4 and later:
@@ -655,54 +670,54 @@ SMTP(8)                                                                SMTP(8)
               Try to make multiple deliveries per TLS-encrypted connection.
 
        <b><a href="postconf.5.html#smtp_tls_chain_files">smtp_tls_chain_files</a> (empty)</b>
-              List  of one or more PEM files, each holding one or more private
+              List of one or more PEM files, each holding one or more  private
               keys directly followed by a corresponding certificate chain.
 
        <b><a href="postconf.5.html#smtp_tls_servername">smtp_tls_servername</a> (empty)</b>
-              Optional name to send to the  remote  SMTP  server  in  the  TLS
+              Optional  name  to  send  to  the  remote SMTP server in the TLS
               Server Name Indication (SNI) extension.
 
        Available in Postfix 3.5, 3.4.6, 3.3.5, 3.2.10, 3.1.13 and later:
 
        <b><a href="postconf.5.html#tls_fast_shutdown_enable">tls_fast_shutdown_enable</a> (yes)</b>
-              A  workaround  for implementations that hang Postfix while shut-
+              A workaround for implementations that hang Postfix  while  shut-
               ting down a TLS session, until Postfix times out.
 
 <b>OBSOLETE STARTTLS CONTROLS</b>
-       The following configuration parameters  exist  for  compatibility  with
-       Postfix  versions  before  2.3.  Support for these will be removed in a
+       The  following  configuration  parameters  exist for compatibility with
+       Postfix versions before 2.3. Support for these will  be  removed  in  a
        future release.
 
        <b><a href="postconf.5.html#smtp_use_tls">smtp_use_tls</a> (no)</b>
-              Opportunistic mode: use TLS when a remote SMTP server  announces
+              Opportunistic  mode: use TLS when a remote SMTP server announces
               STARTTLS support, otherwise send the mail in the clear.
 
        <b><a href="postconf.5.html#smtp_enforce_tls">smtp_enforce_tls</a> (no)</b>
-              Enforcement  mode:  require  that  remote  SMTP  servers use TLS
+              Enforcement mode: require  that  remote  SMTP  servers  use  TLS
               encryption, and never send mail in the clear.
 
        <b><a href="postconf.5.html#smtp_tls_enforce_peername">smtp_tls_enforce_peername</a> (yes)</b>
-              With mandatory TLS encryption,  require  that  the  remote  SMTP
-              server  hostname  matches  the  information  in  the remote SMTP
+              With  mandatory  TLS  encryption,  require  that the remote SMTP
+              server hostname matches  the  information  in  the  remote  SMTP
               server certificate.
 
        <b><a href="postconf.5.html#smtp_tls_per_site">smtp_tls_per_site</a> (empty)</b>
-              Optional lookup tables with the Postfix SMTP  client  TLS  usage
-              policy  by  next-hop destination and by remote SMTP server host-
+              Optional  lookup  tables  with the Postfix SMTP client TLS usage
+              policy by next-hop destination and by remote SMTP  server  host-
               name.
 
        <b><a href="postconf.5.html#smtp_tls_cipherlist">smtp_tls_cipherlist</a> (empty)</b>
-              Obsolete Postfix &lt; 2.3 control for the Postfix SMTP  client  TLS
+              Obsolete  Postfix  &lt; 2.3 control for the Postfix SMTP client TLS
               cipher list.
 
 <b>RESOURCE AND RATE CONTROLS</b>
        <b><a href="postconf.5.html#smtp_connect_timeout">smtp_connect_timeout</a> (30s)</b>
-              The  Postfix SMTP client time limit for completing a TCP connec-
+              The Postfix SMTP client time limit for completing a TCP  connec-
               tion, or zero (use the operating system built-in time limit).
 
        <b><a href="postconf.5.html#smtp_helo_timeout">smtp_helo_timeout</a> (300s)</b>
-              The Postfix SMTP client time limit for sending the HELO or  EHLO
-              command,  and  for  receiving  the  initial  remote  SMTP server
+              The  Postfix SMTP client time limit for sending the HELO or EHLO
+              command, and  for  receiving  the  initial  remote  SMTP  server
               response.
 
        <b><a href="postconf.5.html#lmtp_lhlo_timeout">lmtp_lhlo_timeout</a> (300s)</b>
@@ -714,19 +729,19 @@ SMTP(8)                                                                SMTP(8)
               mand, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_mail_timeout">smtp_mail_timeout</a> (300s)</b>
-              The Postfix SMTP client time limit for  sending  the  MAIL  FROM
+              The  Postfix  SMTP  client  time limit for sending the MAIL FROM
               command, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_rcpt_timeout">smtp_rcpt_timeout</a> (300s)</b>
-              The  Postfix SMTP client time limit for sending the SMTP RCPT TO
+              The Postfix SMTP client time limit for sending the SMTP RCPT  TO
               command, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_data_init_timeout">smtp_data_init_timeout</a> (120s)</b>
-              The Postfix SMTP client time limit for  sending  the  SMTP  DATA
+              The  Postfix  SMTP  client  time limit for sending the SMTP DATA
               command, and for receiving the remote SMTP server response.
 
        <b><a href="postconf.5.html#smtp_data_xfer_timeout">smtp_data_xfer_timeout</a> (180s)</b>
-              The  Postfix SMTP client time limit for sending the SMTP message
+              The Postfix SMTP client time limit for sending the SMTP  message
               content.
 
        <b><a href="postconf.5.html#smtp_data_done_timeout">smtp_data_done_timeout</a> (600s)</b>
@@ -740,13 +755,13 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.1 and later:
 
        <b><a href="postconf.5.html#smtp_mx_address_limit">smtp_mx_address_limit</a> (5)</b>
-              The maximal number of MX (mail exchanger) IP addresses that  can
-              result  from Postfix SMTP client mail exchanger lookups, or zero
+              The  maximal number of MX (mail exchanger) IP addresses that can
+              result from Postfix SMTP client mail exchanger lookups, or  zero
               (no limit).
 
        <b><a href="postconf.5.html#smtp_mx_session_limit">smtp_mx_session_limit</a> (2)</b>
-              The maximal number of SMTP sessions per delivery request  before
-              the  Postfix  SMTP  client  gives  up or delivers to a fall-back
+              The  maximal number of SMTP sessions per delivery request before
+              the Postfix SMTP client gives up  or  delivers  to  a  fall-back
               <a href="postconf.5.html#relayhost">relay host</a>, or zero (no limit).
 
        <b><a href="postconf.5.html#smtp_rset_timeout">smtp_rset_timeout</a> (20s)</b>
@@ -756,17 +771,17 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.2 and earlier:
 
        <b><a href="postconf.5.html#lmtp_cache_connection">lmtp_cache_connection</a> (yes)</b>
-              Keep  Postfix  LMTP  client connections open for up to $<a href="postconf.5.html#max_idle">max_idle</a>
+              Keep Postfix LMTP client connections open for  up  to  $<a href="postconf.5.html#max_idle">max_idle</a>
               seconds.
 
        Available in Postfix version 2.2 and later:
 
        <b><a href="postconf.5.html#smtp_connection_cache_destinations">smtp_connection_cache_destinations</a> (empty)</b>
-              Permanently enable SMTP connection  caching  for  the  specified
+              Permanently  enable  SMTP  connection  caching for the specified
               destinations.
 
        <b><a href="postconf.5.html#smtp_connection_cache_on_demand">smtp_connection_cache_on_demand</a> (yes)</b>
-              Temporarily  enable  SMTP connection caching while a destination
+              Temporarily enable SMTP connection caching while  a  destination
               has a high volume of mail in the <a href="QSHAPE_README.html#active_queue">active queue</a>.
 
        <b><a href="postconf.5.html#smtp_connection_reuse_time_limit">smtp_connection_reuse_time_limit</a> (300s)</b>
@@ -780,23 +795,23 @@ SMTP(8)                                                                SMTP(8)
        Available in Postfix version 2.3 and later:
 
        <b><a href="postconf.5.html#connection_cache_protocol_timeout">connection_cache_protocol_timeout</a> (5s)</b>
-              Time limit for connection cache connect, send or receive  opera-
+              Time  limit for connection cache connect, send or receive opera-
               tions.
 
-       Available in Postfix version 2.9 and later:
+       Available in Postfix version 2.9 - 3.6:
 
        <b><a href="postconf.5.html#smtp_per_record_deadline">smtp_per_record_deadline</a> (no)</b>
-              Change  the  behavior  of the smtp_*_timeout time limits, from a
-              time limit per read or write system call, to  a  time  limit  to
-              send  or  receive  a complete record (an SMTP command line, SMTP
-              response line, SMTP message content line, or TLS  protocol  mes-
+              Change the behavior of the smtp_*_timeout time  limits,  from  a
+              time  limit  per  read  or write system call, to a time limit to
+              send or receive a complete record (an SMTP  command  line,  SMTP
+              response  line,  SMTP message content line, or TLS protocol mes-
               sage).
 
        Available in Postfix version 2.11 and later:
 
        <b><a href="postconf.5.html#smtp_connection_reuse_count_limit">smtp_connection_reuse_count_limit</a> (0)</b>
-              When  SMTP  connection  caching  is enabled, the number of times
-              that an SMTP session may be reused before it is closed, or  zero
+              When SMTP connection caching is enabled,  the  number  of  times
+              that  an SMTP session may be reused before it is closed, or zero
               (no limit).
 
        Available in Postfix version 3.4 and later:
@@ -804,6 +819,19 @@ SMTP(8)                                                                SMTP(8)
        <b><a href="postconf.5.html#smtp_tls_connection_reuse">smtp_tls_connection_reuse</a> (no)</b>
               Try to make multiple deliveries per TLS-encrypted connection.
 
+       Available in Postfix version 3.7 and later:
+
+       <b><a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a> (no)</b>
+              Change the behavior of the smtp_*_timeout time  limits,  from  a
+              time  limit  per  plaintext or TLS read or write call, to a com-
+              bined time limit for sending a complete  SMTP  request  and  for
+              receiving a complete SMTP response.
+
+       <b><a href="postconf.5.html#smtp_min_data_rate">smtp_min_data_rate</a> (500)</b>
+              The  minimum  plaintext  data  transfer rate in bytes/second for
+              DATA    requests,    when    deadlines    are    enabled    with
+              <a href="postconf.5.html#smtp_per_request_deadline">smtp_per_request_deadline</a>.
+
        Implemented in the <a href="qmgr.8.html">qmgr(8)</a> daemon:
 
        <b>transport_destination_concurrency_limit   ($<a href="postconf.5.html#default_destination_concurrency_limit">default_destination_concur</a>-</b>
index 6f23b5c7529ea37994faccd44c161239fd0cff0e..8d8f6dc6fc5d76ebd2097c05655528103b66deb5 100644 (file)
@@ -145,7 +145,7 @@ SMTPD(8)                                                              SMTPD(8)
        <b><a href="postconf.5.html#smtpd_command_filter">smtpd_command_filter</a> (empty)</b>
               A mechanism to transform commands from remote SMTP clients.
 
-       Available in Postfix version 2.9 and later:
+       Available in Postfix version 2.9 - 3.6:
 
        <b><a href="postconf.5.html#smtpd_per_record_deadline">smtpd_per_record_deadline</a> (normal: no, overload: yes)</b>
               Change  the  behavior  of  the  <a href="postconf.5.html#smtpd_timeout">smtpd_timeout</a>  and  <a href="postconf.5.html#smtpd_starttls_timeout">smtpd_start</a>-
@@ -170,6 +170,19 @@ SMTPD(8)                                                              SMTPD(8)
               Optional  setting  that  avoids lookups in the <b>services</b>(5) data-
               base.
 
+       Available in Postfix version 3.7 and later:
+
+       <b><a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a> (normal: no, overload: yes)</b>
+              Change  the  behavior  of  the  <a href="postconf.5.html#smtpd_timeout">smtpd_timeout</a>  and  <a href="postconf.5.html#smtpd_starttls_timeout">smtpd_start</a>-
+              <a href="postconf.5.html#smtpd_starttls_timeout">tls_timeout</a>  time limits, from a time limit per plaintext or TLS
+              read or write call, to a combined time  limit  for  receiving  a
+              complete  SMTP request and for sending a complete SMTP response.
+
+       <b><a href="postconf.5.html#smtpd_min_data_rate">smtpd_min_data_rate</a> (500)</b>
+              The minimum plaintext data transfer  rate  in  bytes/second  for
+              DATA   and  BDAT  requests,  when  deadlines  are  enabled  with
+              <a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a>.
+
 <b>ADDRESS REWRITING CONTROLS</b>
        See the <a href="ADDRESS_REWRITING_README.html">ADDRESS_REWRITING_README</a> document for a detailed discussion  of
        Postfix address rewriting.
@@ -909,7 +922,7 @@ SMTPD(8)                                                              SMTPD(8)
               remote SMTP client is allowed to negotiate with this service per
               time unit.
 
-       Available in Postfix version 2.9 and later:
+       Available in Postfix version 2.9 - 3.6:
 
        <b><a href="postconf.5.html#smtpd_per_record_deadline">smtpd_per_record_deadline</a> (normal: no, overload: yes)</b>
               Change  the  behavior  of  the  <a href="postconf.5.html#smtpd_timeout">smtpd_timeout</a>  and  <a href="postconf.5.html#smtpd_starttls_timeout">smtpd_start</a>-
@@ -925,6 +938,19 @@ SMTPD(8)                                                              SMTPD(8)
               to  send to this service per time unit, regardless of whether or
               not Postfix actually accepts those commands.
 
+       Available in Postfix version 3.7 and later:
+
+       <b><a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a> (normal: no, overload: yes)</b>
+              Change  the  behavior  of  the  <a href="postconf.5.html#smtpd_timeout">smtpd_timeout</a>  and  <a href="postconf.5.html#smtpd_starttls_timeout">smtpd_start</a>-
+              <a href="postconf.5.html#smtpd_starttls_timeout">tls_timeout</a>  time limits, from a time limit per plaintext or TLS
+              read or write call, to a combined time  limit  for  receiving  a
+              complete  SMTP request and for sending a complete SMTP response.
+
+       <b><a href="postconf.5.html#smtpd_min_data_rate">smtpd_min_data_rate</a> (500)</b>
+              The minimum plaintext data transfer  rate  in  bytes/second  for
+              DATA   and  BDAT  requests,  when  deadlines  are  enabled  with
+              <a href="postconf.5.html#smtpd_per_request_deadline">smtpd_per_request_deadline</a>.
+
 <b>TARPIT CONTROLS</b>
        When a remote SMTP client makes errors, the  Postfix  SMTP  server  can
        insert  delays  before  responding. This can help to slow down run-away
index 87f9c5706556bbba1fd9b3545327bd2d9733e19c..4b4752950d96653d78c6d0cdef35095fb9866d4c 100644 (file)
@@ -3049,6 +3049,11 @@ The LMTP\-specific version of the smtp_mime_header_checks
 configuration parameter. See there for details.
 .PP
 This feature is available in Postfix 2.5 and later.
+.SH lmtp_min_data_rate (default: 500)
+The LMTP\-specific version of the smtp_min_data_rate configuration
+parameter. See there for details.
+.PP
+This feature is available in Postfix 3.7 and later.
 .SH lmtp_mx_address_limit (default: 5)
 The LMTP\-specific version of the smtp_mx_address_limit configuration
 parameter.  See there for details.
@@ -3069,6 +3074,11 @@ The LMTP\-specific version of the smtp_per_record_deadline
 configuration parameter.  See there for details.
 .PP
 This feature is available in Postfix 2.9 and later.
+.SH lmtp_per_request_deadline (default: no)
+The LMTP\-specific version of the smtp_per_request_deadline
+configuration parameter. See there for details.
+.PP
+This feature is available in Postfix 3.7 and later.
 .SH lmtp_pix_workaround_delay_time (default: 10s)
 The LMTP\-specific version of the smtp_pix_workaround_delay_time
 configuration parameter.  See there for details.
@@ -7340,6 +7350,17 @@ Actions that change the delivery time or destination are not
 available.
 .PP
 This feature is available in Postfix 2.5 and later.
+.SH smtp_min_data_rate (default: 500)
+The minimum plaintext data transfer rate in bytes/second for
+DATA requests, when deadlines are enabled with smtp_per_request_deadline.
+After a write operation transfers N plaintext message bytes (possibly
+after TLS encryption), and after the DATA request deadline is
+decremented by the elapsed time of that write operation, the DATA
+request deadline is incremented by N/smtp_min_data_rate seconds.
+However, the deadline will never be incremented beyond the time
+limit specified with smtp_data_xfer_timeout.
+.PP
+This feature is available in Postfix 3.7 and later.
 .SH smtp_mx_address_limit (default: 5)
 The maximal number of MX (mail exchanger) IP addresses that can
 result from Postfix SMTP client mail exchanger lookups, or zero (no
@@ -7380,9 +7401,32 @@ The reasons are that a TLS protocol message can be up to 16 kbytes
 long (with TLSv1), and that an entire TLS protocol message must be
 sent or received within the per\-record deadline.
 .PP
-This feature is available in Postfix 2.9 and later. With older
+This feature is available in Postfix 2.9\-3.6. With older
 Postfix releases, the behavior is as if this parameter is set to
-"no".
+"no". Postfix 3.7 and later use smtp_per_request_deadline.
+.SH smtp_per_request_deadline (default: no)
+Change the behavior of the smtp_*_timeout time limits, from a
+time limit per plaintext or TLS read or write call, to a combined
+time limit for sending a complete SMTP request and for receiving a
+complete SMTP response. The deadline limits only the time spent
+waiting for plaintext or TLS read or write calls, not time spent
+elsewhere. The per\-request deadline limits the impact from hostile
+peers that trickle data one byte at a time.
+.PP
+See smtp_min_data_rate for how the per\-request deadline is
+managed during the DATA phase.
+.PP
+Note: when per\-request deadlines are enabled, a short time limit
+may cause problems with TLS over very slow network connections. The
+reason is that a TLS protocol message can be up to 16 kbytes long
+(with TLSv1), and that an entire TLS protocol message must be
+transferred within the per\-request deadline.
+.PP
+This feature is available in Postfix 3.7 and later. A weaker
+feature, called smtp_per_record_deadline, is available with Postfix
+2.9\-3.6.
+.PP
+This feature is available in Postfix 3.7 and later.
 .SH smtp_pix_workaround_delay_time (default: 10s)
 How long the Postfix SMTP client pauses before sending
 ".<CR><LF>" in order to work around the PIX firewall
@@ -10672,6 +10716,18 @@ arrives via the Postfix \fBsmtpd\fR(8) server. Specify space or comma as
 separator. See the MILTER_README document for details.
 .PP
 This feature is available in Postfix 2.3 and later.
+.SH smtpd_min_data_rate (default: 500)
+The minimum plaintext data transfer rate in bytes/second for
+DATA and BDAT requests, when deadlines are enabled with
+smtpd_per_request_deadline. After a read operation transfers N
+plaintext message bytes (possibly after TLS decryption), and after
+the DATA or BDAT request deadline is decremented by the elapsed
+time of that read operation, the DATA or BDAT request deadline is
+incremented by N/smtpd_min_data_rate seconds. However, the deadline
+will never be incremented beyond the time limit specified with
+smtpd_timeout.
+.PP
+This feature is available in Postfix 3.7 and later.
 .SH smtpd_noop_commands (default: empty)
 List of commands that the Postfix SMTP server replies to with "250
 Ok", without doing any syntax checks and without changing state.
@@ -10702,9 +10758,33 @@ The reasons are that a TLS protocol message can be up to 16 kbytes
 long (with TLSv1), and that an entire TLS protocol message must be
 sent or received within the per\-record deadline.
 .PP
-This feature is available in Postfix 2.9 and later. With older
+This feature is available in Postfix 2.9\-3.6. With older
 Postfix releases, the behavior is as if this parameter is set to
-"no".
+"no". Postfix 3.7 and later use smtpd_per_request_deadline.
+.SH smtpd_per_request_deadline (default: normal: no, overload: yes)
+Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
+time limits, from a time limit per plaintext or TLS read or write
+call, to a combined time limit for receiving a complete SMTP request
+and for sending a complete SMTP response. The deadline limits only
+the time spent waiting for plaintext or TLS read or write calls,
+not time spent elsewhere. The per\-request deadline limits the impact
+from hostile peers that trickle data one byte at a time.
+.PP
+See smtpd_min_data_rate for how the per\-request deadline is
+managed during the DATA and BDAT phase.
+.PP
+Note: when per\-request deadlines are enabled, a short time limit
+may cause problems with TLS over very slow network connections. The
+reason is that a TLS protocol message can be up to 16 kbytes long
+(with TLSv1), and that an entire TLS protocol message must be
+transferred within the per\-request deadline.
+.PP
+This feature is available in Postfix 3.7 and later. A weaker
+feature, called smtpd_per_record_deadline, is available with Postfix
+2.9\-3.6. With older Postfix releases, the behavior is as if this
+parameter is set to "no".
+.PP
+This feature is available in Postfix 3.7 and later.
 .SH smtpd_policy_service_default_action (default: 451 4.3.5 Server configuration problem)
 The default action when an SMTPD policy service request fails.
 Specify "DUNNO" to behave as if the failed  SMTPD policy service
@@ -11733,8 +11813,9 @@ response, how long the Postfix SMTP server will wait for an underlying
 network write operation to complete; and when the Postfix SMTP
 server Postfix wants to receive an SMTP client request, how long
 the Postfix SMTP server will wait for an underlying network read
-operation to complete. See smtpd_per_record_deadline for how this
-time limit may be enforced.
+operation to complete. See the smtpd_per_request_deadline for how
+this time limit may be enforced (with Postfix 2.9\-3.6 see
+smtpd_per_record_deadline).
 .PP
 Normally the default limit
 is 300s, but it changes under overload to just 10s. With Postfix
index 0472b9cad45893307a7d3250c04f556a015c554b..656c6eed87336f80dfc8936566dc51e0cefe2aaf 100644 (file)
@@ -324,12 +324,14 @@ Available in Postfix version 2.8 and later:
 .IP "\fBsmtp_dns_resolver_options (empty)\fR"
 DNS Resolver options for the Postfix SMTP client.
 .PP
-Available in Postfix version 2.9 and later:
+Available in Postfix version 2.9 \- 3.6:
 .IP "\fBsmtp_per_record_deadline (no)\fR"
 Change the behavior of the smtp_*_timeout time limits, from a
 time limit per read or write system call, to a time limit to send
 or receive a complete record (an SMTP command line, SMTP response
 line, SMTP message content line, or TLS protocol message).
+.PP
+Available in Postfix version 2.9 and later:
 .IP "\fBsmtp_send_dummy_mail_auth (no)\fR"
 Whether or not to append the "AUTH=<>" option to the MAIL
 FROM command in SASL\-authenticated SMTP sessions.
@@ -364,6 +366,16 @@ The DNS query type (default: "ns") and DNS query name (default:
 is available.
 .IP "\fBknown_tcp_ports (lmtp=24, smtp=25, smtps=submissions=465, submission=587)\fR"
 Optional setting that avoids lookups in the \fBservices\fR(5) database.
+.PP
+Available in Postfix version 3.7 and later:
+.IP "\fBsmtp_per_request_deadline (no)\fR"
+Change the behavior of the smtp_*_timeout time limits, from a
+time limit per plaintext or TLS read or write call, to a combined
+time limit for sending a complete SMTP request and for receiving a
+complete SMTP response.
+.IP "\fBsmtp_min_data_rate (500)\fR"
+The minimum plaintext data transfer rate in bytes/second for
+DATA requests, when deadlines are enabled with smtp_per_request_deadline.
 .SH "MIME PROCESSING CONTROLS"
 .na
 .nf
@@ -700,7 +712,7 @@ Available in Postfix version 2.3 and later:
 Time limit for connection cache connect, send or receive
 operations.
 .PP
-Available in Postfix version 2.9 and later:
+Available in Postfix version 2.9 \- 3.6:
 .IP "\fBsmtp_per_record_deadline (no)\fR"
 Change the behavior of the smtp_*_timeout time limits, from a
 time limit per read or write system call, to a time limit to send
@@ -717,6 +729,16 @@ Available in Postfix version 3.4 and later:
 .IP "\fBsmtp_tls_connection_reuse (no)\fR"
 Try to make multiple deliveries per TLS\-encrypted connection.
 .PP
+Available in Postfix version 3.7 and later:
+.IP "\fBsmtp_per_request_deadline (no)\fR"
+Change the behavior of the smtp_*_timeout time limits, from a
+time limit per plaintext or TLS read or write call, to a combined
+time limit for sending a complete SMTP request and for receiving a
+complete SMTP response.
+.IP "\fBsmtp_min_data_rate (500)\fR"
+The minimum plaintext data transfer rate in bytes/second for
+DATA requests, when deadlines are enabled with smtp_per_request_deadline.
+.PP
 Implemented in the qmgr(8) daemon:
 .IP "\fBtransport_destination_concurrency_limit ($default_destination_concurrency_limit)\fR"
 A transport\-specific override for the
index 3c294d405c89696596f2be38b032861d684e4a3e..ea910ae06c5e732273d4b0da16509faa5dff6b5d 100644 (file)
@@ -149,7 +149,7 @@ Available in Postfix version 2.7 and later:
 .IP "\fBsmtpd_command_filter (empty)\fR"
 A mechanism to transform commands from remote SMTP clients.
 .PP
-Available in Postfix version 2.9 and later:
+Available in Postfix version 2.9 \- 3.6:
 .IP "\fBsmtpd_per_record_deadline (normal: no, overload: yes)\fR"
 Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
 time limits, from a
@@ -166,6 +166,17 @@ Available in Postfix version 3.6 and later:
 Evaluate smtpd_relay_restrictions before smtpd_recipient_restrictions.
 .IP "\fBknown_tcp_ports (lmtp=24, smtp=25, smtps=submissions=465, submission=587)\fR"
 Optional setting that avoids lookups in the \fBservices\fR(5) database.
+.PP
+Available in Postfix version 3.7 and later:
+.IP "\fBsmtpd_per_request_deadline (normal: no, overload: yes)\fR"
+Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
+time limits, from a time limit per plaintext or TLS read or write
+call, to a combined time limit for receiving a complete SMTP request
+and for sending a complete SMTP response.
+.IP "\fBsmtpd_min_data_rate (500)\fR"
+The minimum plaintext data transfer rate in bytes/second for
+DATA and BDAT requests, when deadlines are enabled with
+smtpd_per_request_deadline.
 .SH "ADDRESS REWRITING CONTROLS"
 .na
 .nf
@@ -799,7 +810,7 @@ The maximal number of new (i.e., uncached) TLS sessions that a
 remote SMTP client is allowed to negotiate with this service per
 time unit.
 .PP
-Available in Postfix version 2.9 and later:
+Available in Postfix version 2.9 \- 3.6:
 .IP "\fBsmtpd_per_record_deadline (normal: no, overload: yes)\fR"
 Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
 time limits, from a
@@ -812,6 +823,17 @@ Available in Postfix version 3.1 and later:
 The maximal number of AUTH commands that any client is allowed to
 send to this service per time unit, regardless of whether or not
 Postfix actually accepts those commands.
+.PP
+Available in Postfix version 3.7 and later:
+.IP "\fBsmtpd_per_request_deadline (normal: no, overload: yes)\fR"
+Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
+time limits, from a time limit per plaintext or TLS read or write
+call, to a combined time limit for receiving a complete SMTP request
+and for sending a complete SMTP response.
+.IP "\fBsmtpd_min_data_rate (500)\fR"
+The minimum plaintext data transfer rate in bytes/second for
+DATA and BDAT requests, when deadlines are enabled with
+smtpd_per_request_deadline.
 .SH "TARPIT CONTROLS"
 .na
 .nf
index 20dac88f594d47339436c49328483e342d9db0a4..01075f4554503585c5c3232a67bea9d0da281516 100755 (executable)
@@ -224,6 +224,8 @@ while (<>) {
     s;\blmtp_mime_header_checks\b;<a href="postconf.5.html#lmtp_mime_header_checks">$&</a>;g;
     s;\blmtp_nested_header_checks\b;<a href="postconf.5.html#lmtp_nested_header_checks">$&</a>;g;
     s;\blmtp_per_record_deadline\b;<a href="postconf.5.html#lmtp_per_record_deadline">$&</a>;g;
+    s;\blmtp_per_request_deadline\b;<a href="postconf.5.html#lmtp_per_request_deadline">$&</a>;g;
+    s;\blmtp_min_data_rate\b;<a href="postconf.5.html#lmtp_min_data_rate">$&</a>;g;
     s;\blmtp_reply_filter\b;<a href="postconf.5.html#lmtp_reply_filter">$&</a>;g;
     s;\blmtp_sasl_password_maps\b;<a href="postconf.5.html#lmtp_sasl_password_maps">$&</a>;g;
     s;\blmtp_send_dummy_mail_auth\b;<a href="postconf.5.html#lmtp_send_dummy_mail_auth">$&</a>;g;
@@ -694,6 +696,8 @@ while (<>) {
     s;\bsmtp_reply_filter\b;<a href="postconf.5.html#smtp_reply_filter">$&</a>;g;
     s;\bsmtp_address_preference\b;<a href="postconf.5.html#smtp_address_preference">$&</a>;g;
     s;\bsmtp_per_record_deadline\b;<a href="postconf.5.html#smtp_per_record_deadline">$&</a>;g;
+    s;\bsmtp_per_request_deadline\b;<a href="postconf.5.html#smtp_per_request_deadline">$&</a>;g;
+    s;\bsmtp_min_data_rate\b;<a href="postconf.5.html#smtp_min_data_rate">$&</a>;g;
     s;\bsmtp_send_dummy_mail_auth\b;<a href="postconf.5.html#smtp_send_dummy_mail_auth">$&</a>;g;
     s;\bsmtp_balance_inet_protocols\b;<a href="postconf.5.html#smtp_balance_inet_protocols">$&</a>;g;
     s;\binfo_log_address_format\b;<a href="postconf.5.html#info_log_address_format">$&</a>;g;
@@ -740,6 +744,8 @@ while (<>) {
     s;\bsmtpd_reject_footer\b;<a href="postconf.5.html#smtpd_reject_footer">$&</a>;g;
     s;\bsmtpd_reject_footer_maps\b;<a href="postconf.5.html#smtpd_reject_footer_maps">$&</a>;g;
     s;\bsmtpd_per_record_deadline\b;<a href="postconf.5.html#smtpd_per_record_deadline">$&</a>;g;
+    s;\bsmtpd_per_request_deadline\b;<a href="postconf.5.html#smtpd_per_request_deadline">$&</a>;g;
+    s;\bsmtpd_min_data_rate\b;<a href="postconf.5.html#smtpd_min_data_rate">$&</a>;g;
     s;\bsmtpd_upstream_proxy_protocol\b;<a href="postconf.5.html#smtpd_upstream_proxy_protocol">$&</a>;g;
     s;\bsmtpd_upstream_proxy_timeout\b;<a href="postconf.5.html#smtpd_upstream_proxy_timeout">$&</a>;g;
     s;\btls_daemon_random_bytes\b;<a href="postconf.5.html#tls_daemon_random_bytes">$&</a>;g;
index 1a01b713d932d10cafe8d45b35a4e143815bd124..29164fb3558aecd08b682a4c68caca56226f30df 100644 (file)
@@ -6715,8 +6715,9 @@ response, how long the Postfix SMTP server will wait for an underlying
 network write operation to complete; and when the Postfix SMTP
 server Postfix wants to receive an SMTP client request, how long
 the Postfix SMTP server will wait for an underlying network read
-operation to complete. See smtpd_per_record_deadline for how this
-time limit may be enforced. </p>
+operation to complete. See the smtpd_per_request_deadline for how
+this time limit may be enforced (with Postfix 2.9-3.6 see
+smtpd_per_record_deadline). </p>
 
 <p> Normally the default limit
 is 300s, but it changes under overload to just 10s. With Postfix
@@ -15656,9 +15657,9 @@ The reasons are that a TLS protocol message can be up to 16 kbytes
 long (with TLSv1), and that an entire TLS protocol message must be
 sent or received within the per-record deadline.  </p>
 
-<p> This feature is available in Postfix 2.9 and later. With older
+<p> This feature is available in Postfix 2.9-3.6. With older
 Postfix releases, the behavior is as if this parameter is set to
-"no". </p>
+"no". Postfix 3.7 and later use smtpd_per_request_deadline. </p>
 
 %PARAM smtp_per_record_deadline no
 
@@ -15675,9 +15676,9 @@ The reasons are that a TLS protocol message can be up to 16 kbytes
 long (with TLSv1), and that an entire TLS protocol message must be
 sent or received within the per-record deadline.  </p>
 
-<p> This feature is available in Postfix 2.9 and later. With older
+<p> This feature is available in Postfix 2.9-3.6. With older
 Postfix releases, the behavior is as if this parameter is set to
-"no". </p>
+"no". Postfix 3.7 and later use smtp_per_request_deadline. </p>
 
 %PARAM lmtp_per_record_deadline no
 
@@ -18071,3 +18072,95 @@ name-to-port = 1*(service-name "=') port-number
 inside a service name or port number. </p>
 
 <p> This feature is available in Postfix 3.6 and later. </p>
+
+%PARAM smtpd_min_data_rate 500
+
+<p> The minimum plaintext data transfer rate in bytes/second for
+DATA and BDAT requests, when deadlines are enabled with
+smtpd_per_request_deadline. After a read operation transfers N
+plaintext message bytes (possibly after TLS decryption), and after
+the DATA or BDAT request deadline is decremented by the elapsed
+time of that read operation, the DATA or BDAT request deadline is
+incremented by N/smtpd_min_data_rate seconds. However, the deadline
+will never be incremented beyond the time limit specified with
+smtpd_timeout.  </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+%PARAM smtpd_per_request_deadline normal: no, overload: yes
+
+<p> Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
+time limits, from a time limit per plaintext or TLS read or write
+call, to a combined time limit for receiving a complete SMTP request
+and for sending a complete SMTP response. The deadline limits only
+the time spent waiting for plaintext or TLS read or write calls,
+not time spent elsewhere. The per-request deadline limits the impact
+from hostile peers that trickle data one byte at a time. </p>
+
+<p> See smtpd_min_data_rate for how the per-request deadline is
+managed during the DATA and BDAT phase. </p>
+
+<p> Note: when per-request deadlines are enabled, a short time limit
+may cause problems with TLS over very slow network connections. The
+reason is that a TLS protocol message can be up to 16 kbytes long
+(with TLSv1), and that an entire TLS protocol message must be
+transferred within the per-request deadline. </p>
+
+<p> This feature is available in Postfix 3.7 and later. A weaker
+feature, called smtpd_per_record_deadline, is available with Postfix
+2.9-3.6. With older Postfix releases, the behavior is as if this
+parameter is set to "no". </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+%PARAM lmtp_min_data_rate 500
+
+<p> The LMTP-specific version of the smtp_min_data_rate configuration
+parameter. See there for details. </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+%PARAM lmtp_per_request_deadline no
+
+<p> The LMTP-specific version of the smtp_per_request_deadline
+configuration parameter. See there for details. </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+%PARAM smtp_min_data_rate 500
+
+<p> The minimum plaintext data transfer rate in bytes/second for
+DATA requests, when deadlines are enabled with smtp_per_request_deadline.
+After a write operation transfers N plaintext message bytes (possibly
+after TLS encryption), and after the DATA request deadline is
+decremented by the elapsed time of that write operation, the DATA
+request deadline is incremented by N/smtp_min_data_rate seconds.
+However, the deadline will never be incremented beyond the time
+limit specified with smtp_data_xfer_timeout.  </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
+
+%PARAM smtp_per_request_deadline no
+
+<p> Change the behavior of the smtp_*_timeout time limits, from a
+time limit per plaintext or TLS read or write call, to a combined
+time limit for sending a complete SMTP request and for receiving a
+complete SMTP response. The deadline limits only the time spent
+waiting for plaintext or TLS read or write calls, not time spent
+elsewhere. The per-request deadline limits the impact from hostile
+peers that trickle data one byte at a time. </p>
+
+<p> See smtp_min_data_rate for how the per-request deadline is
+managed during the DATA phase. </p>
+
+<p> Note: when per-request deadlines are enabled, a short time limit
+may cause problems with TLS over very slow network connections. The
+reason is that a TLS protocol message can be up to 16 kbytes long
+(with TLSv1), and that an entire TLS protocol message must be
+transferred within the per-request deadline. </p>
+
+<p> This feature is available in Postfix 3.7 and later. A weaker
+feature, called smtp_per_record_deadline, is available with Postfix
+2.9-3.6. </p>
+
+<p> This feature is available in Postfix 3.7 and later. </p>
index b3af01b99ad71ab41880acf85688a1904d13edd2..1e03ab6a3fadc16801360783e7d5a38e1a853454 100644 (file)
@@ -4091,6 +4091,30 @@ extern bool var_smtpd_rec_deadline;
 #define DEF_LMTP_REC_DEADLINE  0
 extern bool var_smtp_rec_deadline;
 
+#define VAR_SMTPD_REQ_DEADLINE "smtpd_per_request_deadline"
+#define DEF_SMTPD_REQ_DEADLINE "${smtpd_per_record_deadline?" \
+                               "{$smtpd_per_record_deadline}:" \
+                               "{${stress?{yes}:{no}}}}"
+extern bool var_smtpd_req_deadline;
+
+#define VAR_SMTP_REQ_DEADLINE  "smtp_per_request_deadline"
+#define DEF_SMTP_REQ_DEADLINE  "${smtp_per_record_deadline?" \
+                               "{$smtp_per_record_deadline}:{no}}"
+#define VAR_LMTP_REQ_DEADLINE  "lmtp_per_request_deadline"
+#define DEF_LMTP_REQ_DEADLINE  "${lmtp_per_record_deadline?" \
+                               "{$lmtp_per_record_deadline}:{no}}"
+extern bool var_smtp_req_deadline;
+
+#define VAR_SMTPD_MIN_DATA_RATE        "smtpd_min_data_rate"
+#define DEF_SMTPD_MIN_DATA_RATE        500
+extern int var_smtpd_min_data_rate;
+
+#define VAR_SMTP_MIN_DATA_RATE "smtp_min_data_rate"
+#define DEF_SMTP_MIN_DATA_RATE 500
+#define VAR_LMTP_MIN_DATA_RATE "smtp_min_data_rate"
+#define DEF_LMTP_MIN_DATA_RATE 500
+extern int var_smtp_min_data_rate;
+
  /*
   * Permit logging.
   */
index 0ff7c0c476376a4e01fbd71b441e59bfadb16413..d0e749a70f1c390deb334b88f495c7ed23acb719 100644 (file)
@@ -20,7 +20,7 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE      "20210814"
+#define MAIL_RELEASE_DATE      "20210815"
 #define MAIL_VERSION_NUMBER    "3.7"
 
 #ifdef SNAPSHOT
index a42cdcfd25f0beb3187793abed898e42042e6756..595a159f04547b6480dd1eabf5bf5da475cd1f62 100644 (file)
@@ -6,10 +6,12 @@
 /* SYNOPSIS
 /*     #include <smtp_stream.h>
 /*
-/*     void    smtp_stream_setup(stream, timeout, enable_deadline)
+/*     void    smtp_stream_setup(stream, timeout, enable_deadline,
+/*                                     min_data_rate)
 /*     VSTREAM *stream;
 /*     int     timeout;
 /*     int     enable_deadline;
+/*     int     min_data_rate;
 /*
 /*     void    smtp_printf(stream, format, ...)
 /*     VSTREAM *stream;
@@ -60,7 +62,6 @@
 /*     void    smtp_timeout_setup(stream, timeout)
 /*     VSTREAM *stream;
 /*     int     timeout;
-/*     int     enable_deadline;
 /* DESCRIPTION
 /*     This module reads and writes text records delimited by CR LF,
 /*     with error detection: timeouts or unexpected end-of-file.
 /*     and write operations described below.
 /*     This routine alters the behavior of streams as follows:
 /* .IP \(bu
-/*     When enable_deadline is non-zero, the stream is configured
-/*     to enforce a total time limit for each smtp_stream read/write
-/*     operation. Otherwise, the stream is configured to enforce
+/*     When enable_deadline is non-zero, then the timeout argument
+/*     specifies a deadline for the total amount time that may be
+/*     spent in all subsequent read/write operations.
+/*     Otherwise, the stream is configured to enforce
 /*     a time limit for each individual read/write system call.
 /* .IP \f(bu
+/*     Additionally, when min_data_rate is > 0, the deadline is
+/*     incremented by 1/min_data_rate seconds for every min_data_rate
+/*     bytes transferred. However, the deadline will never exceed
+/*     the value specified with the timeout argument.
+/* .IP \f(bu
 /*     The stream is configured to use double buffering.
 /* .IP \f(bu
 /*     The stream is configured to enable exception handling.
 /*     query the stream status with vstream_feof() etc.
 /*
 /*     smtp_timeout_setup() is a backwards-compatibility interface
-/*     for programs that don't require per-record deadline support.
+/*     for programs that don't require deadline or data-rate support.
 /* DIAGNOSTICS
 /* .fi
 /* .ad
 
 #include "smtp_stream.h"
 
-/* smtp_timeout_reset - reset per-stream error flags, restart deadline timer */
+ /*
+  * Important: the time limit feature must not introduce any system calls
+  * when the input is already in the buffer, or when the output still fits in
+  * the buffer. Such system calls would really hurt when receiving or sending
+  * body content one line at a time.
+  */
+
+/* smtp_timeout_reset - reset per-stream error flags */
 
 static void smtp_timeout_reset(VSTREAM *stream)
 {
-    vstream_clearerr(stream);
 
     /*
-     * Important: the time limit feature must not introduce any system calls
-     * when the input is already in the buffer, or when the output still fits
-     * in the buffer. Such system calls would really hurt when receiving or
-     * sending body content one line at a time.
+     * Individual smtp_stream(3) I/O functions must not recharge the deadline
+     * timer, because multiline responses involve multiple smtp_stream(3)
+     * calls, and we really want to limit the time to send or receive a
+     * response.
      */
-    if (vstream_fstat(stream, VSTREAM_FLAG_DEADLINE))
-       vstream_control(stream, CA_VSTREAM_CTL_START_DEADLINE, CA_VSTREAM_CTL_END);
+    vstream_clearerr(stream);
 }
 
 /* smtp_longjmp - raise an exception */
@@ -238,19 +250,21 @@ static NORETURN smtp_longjmp(VSTREAM *stream, int err, const char *context)
 
 /* smtp_stream_setup - configure timeout trap */
 
-void    smtp_stream_setup(VSTREAM *stream, int maxtime, int enable_deadline)
+void    smtp_stream_setup(VSTREAM *stream, int maxtime, int enable_deadline,
+                                 int min_data_rate)
 {
     const char *myname = "smtp_stream_setup";
 
     if (msg_verbose)
-       msg_info("%s: maxtime=%d enable_deadline=%d",
-                myname, maxtime, enable_deadline);
+       msg_info("%s: maxtime=%d enable_deadline=%d min_data_rate=%d",
+                myname, maxtime, enable_deadline, min_data_rate);
 
     vstream_control(stream,
                    CA_VSTREAM_CTL_DOUBLE,
                    CA_VSTREAM_CTL_TIMEOUT(maxtime),
                    enable_deadline ? CA_VSTREAM_CTL_START_DEADLINE
                    : CA_VSTREAM_CTL_STOP_DEADLINE,
+                   CA_VSTREAM_CTL_MIN_DATA_RATE(min_data_rate),
                    CA_VSTREAM_CTL_EXCEPT,
                    CA_VSTREAM_CTL_END);
 }
index ec824b3c35ab2e29437aa259e089afd0b19b1aee..75700fed32e32d6cbaf49f15245f0b727b3e496b 100644 (file)
@@ -33,7 +33,7 @@
 #define SMTP_ERR_NONE  4               /* non-error case */
 #define SMTP_ERR_DATA  5               /* application data error */
 
-extern void smtp_stream_setup(VSTREAM *, int, int);
+extern void smtp_stream_setup(VSTREAM *, int, int, int);
 extern void PRINTFLIKE(2, 3) smtp_printf(VSTREAM *, const char *,...);
 extern void smtp_flush(VSTREAM *);
 extern int smtp_fgetc(VSTREAM *);
@@ -47,7 +47,7 @@ extern void smtp_fputc(int, VSTREAM *);
 extern void smtp_vprintf(VSTREAM *, const char *, va_list);
 
 #define smtp_timeout_setup(stream, timeout) \
-       smtp_stream_setup((stream), (timeout), 0)
+       smtp_stream_setup((stream), (timeout), 0, 0)
 
 #define SMTP_GET_FLAG_NONE     0
 #define SMTP_GET_FLAG_SKIP     (1<<0)  /* skip over excess input */
index c489053875e8211d121e38258851447d9be7bd39..8def3911c88bbb2303dae2895131306675f06c37 100644 (file)
@@ -145,6 +145,9 @@ static const CONFIG_STR_TABLE pcf_legacy_str_table[] = {
     {"postscreen_blacklist_action", ""},
     {"postscreen_dnsbl_whitelist_threshold", ""},
     {"postscreen_whitelist_interfaces", ""},
+    {"lmtp_per_record_deadline", ""},
+    {"smtp_per_record_deadline", ""},
+    {"smtpd_per_record_deadline", ""},
     0,
 };
 
index 84ee53e4b602851bc163f0c5876ef773ec1fc7d8..297eae20c95d85473afc79607228e23b9249e88d 100644 (file)
@@ -74,6 +74,7 @@ postlog.o: ../../include/maillog_client.h
 postlog.o: ../../include/msg.h
 postlog.o: ../../include/msg_output.h
 postlog.o: ../../include/msg_vstream.h
+postlog.o: ../../include/stringops.h
 postlog.o: ../../include/sys_defs.h
 postlog.o: ../../include/vbuf.h
 postlog.o: ../../include/vstream.h
index db03cec00be44f958fd553461f8998883165c6a7..eddc432dddc0ac38759b949fc0bc8b1f28182682 100644 (file)
@@ -237,6 +237,7 @@ int     main(int argc, char **argv)
     int     fd;
     int     ch;
     const char *tag;
+    char   *unsanitized_tag;
     int     level = MSG_INFO;
     ARGV   *import_env;
 
@@ -281,7 +282,7 @@ int     main(int argc, char **argv)
      * validated by the mail configuration read routine. Don't do complex
      * things until we have completed initializations.
      */
-    tag = 0;
+    unsanitized_tag = 0;
     while ((ch = GETOPT(argc, argv, "c:ip:t:v")) > 0) {
        switch (ch) {
        default:
@@ -297,7 +298,7 @@ int     main(int argc, char **argv)
            level = level_map(optarg);
            break;
        case 't':
-           tag = optarg;                       /* sanitized below */
+           unsanitized_tag = optarg;
            break;
        case 'v':
            msg_verbose++;
@@ -325,12 +326,14 @@ int     main(int argc, char **argv)
     import_env = mail_parm_split(VAR_IMPORT_ENVIRON, var_import_environ);
     clean_env(import_env->argv);
     argv_free(import_env);
-    if (tag == 0)
-       /* Use sanitized command name. */
-       tag = mail_task(argv[0]);
-    else
-       /* Sanitize user-specified tag, depends on var_smtputf8_enable. */
-       (void) printable(tag, '?');
+
+    /*
+     * Sanitize the user-specified tag. The result depends on the value of
+     * var_smtputf8_enable, therefore this code is after the mail_conf_read()
+     * call.
+     */
+    if (unsanitized_tag != 0)
+       tag = printable(unsanitized_tag, '?');
 
     /*
      * Re-initialize the logging, this time with the tag specified in main.cf
index 252db401f7b7dc5dda885028153b7c6fa0a6de47..9e8020daee308d59d4d15a368c393d16996095e7 100644 (file)
@@ -618,7 +618,7 @@ static int greeting(STATE *state)
     /*
      * Prepare for disaster.
      */
-    smtp_stream_setup(stream, conn_tmout, 1);
+    smtp_stream_setup(stream, conn_tmout, /* deadline */ 1, /* minrate */ 0);
     if ((except = vstream_setjmp(stream)) != 0) {
        msg_info("%s while reading server greeting", exception_text(except));
        return (1);
@@ -653,6 +653,7 @@ static RESPONSE *ehlo(STATE *state)
     /*
      * Send the standard greeting with our hostname
      */
+    smtp_stream_setup(stream, smtp_tmout, /* deadline */ 1, /* minrate */ 0);
     if ((except = vstream_setjmp(stream)) != 0) {
        msg_info("%s while sending %s", exception_text(except), ehlo);
        return (0);
@@ -740,7 +741,7 @@ static int starttls(STATE *state)
 
     if (state->wrapper_mode == 0) {
        /* SMTP stream with deadline timeouts */
-       smtp_stream_setup(stream, smtp_tmout, 1);
+       smtp_stream_setup(stream, smtp_tmout, /* deadline */ 1, /* minrate */ 0);
        if ((except = vstream_setjmp(stream)) != 0) {
            msg_fatal("%s while sending STARTTLS", exception_text(except));
            return (1);
@@ -780,6 +781,7 @@ static int starttls(STATE *state)
     else
        ADD_EXCLUDE(cipher_exclusions, "eNULL");
 
+    smtp_stream_setup(stream, smtp_tmout, /* deadline */ 1, /* minrate */ 0);
     if (state->tlsproxy_mode) {
        TLS_CLIENT_PARAMS tls_params;
 
@@ -985,7 +987,7 @@ static int doproto(STATE *state)
     /*
      * Prepare for disaster.
      */
-    smtp_stream_setup(stream, smtp_tmout, 1);
+    smtp_stream_setup(stream, smtp_tmout, /* deadline */ 1, /* minrate */ 0);
     if ((except = vstream_setjmp(stream)) != 0) {
        msg_warn("%s while sending QUIT command", exception_text(except));
        return (0);
index 973cb5dfb1bc95addecfb764f3d2977bb0aba030..192d1bd21c99fdb7537e3e12b39f2ce01c258b71 100644 (file)
@@ -98,6 +98,7 @@
 #ifdef USE_TLS
        VAR_LMTP_TLS_SCERT_VD, DEF_LMTP_TLS_SCERT_VD, &var_smtp_tls_scert_vd, 0, 0,
 #endif
+       VAR_LMTP_MIN_DATA_RATE, DEF_LMTP_MIN_DATA_RATE, &var_smtp_min_data_rate, 1, 0,
        0,
     };
     static const CONFIG_BOOL_TABLE lmtp_bool_table[] = {
        VAR_LMTP_CNAME_OVERR, DEF_LMTP_CNAME_OVERR, &var_smtp_cname_overr,
        VAR_LMTP_SASL_AUTH_SOFT_BOUNCE, DEF_LMTP_SASL_AUTH_SOFT_BOUNCE, &var_smtp_sasl_auth_soft_bounce,
        VAR_LMTP_ASSUME_FINAL, DEF_LMTP_ASSUME_FINAL, &var_lmtp_assume_final,
-       VAR_LMTP_REC_DEADLINE, DEF_LMTP_REC_DEADLINE, &var_smtp_rec_deadline,
        VAR_LMTP_DUMMY_MAIL_AUTH, DEF_LMTP_DUMMY_MAIL_AUTH, &var_smtp_dummy_mail_auth,
        VAR_LMTP_BALANCE_INET_PROTO, DEF_LMTP_BALANCE_INET_PROTO, &var_smtp_balance_inet_proto,
        0,
     };
+   static const CONFIG_NBOOL_TABLE lmtp_nbool_table[] = {
+       VAR_LMTP_REQ_DEADLINE, DEF_LMTP_REQ_DEADLINE, &var_smtp_req_deadline,
+       0,
+   };
index 5e39a0a567a58ece0d50be7bf523540eb87ffb5f..c5088798c6705fb4360085b3bb68522a80888c0e 100644 (file)
 /* .IP "\fBsmtp_dns_resolver_options (empty)\fR"
 /*     DNS Resolver options for the Postfix SMTP client.
 /* .PP
-/*     Available in Postfix version 2.9 and later:
+/*     Available in Postfix version 2.9 - 3.6:
 /* .IP "\fBsmtp_per_record_deadline (no)\fR"
 /*     Change the behavior of the smtp_*_timeout time limits, from a
 /*     time limit per read or write system call, to a time limit to send
 /*     or receive a complete record (an SMTP command line, SMTP response
 /*     line, SMTP message content line, or TLS protocol message).
+/* .PP
+/*     Available in Postfix version 2.9 and later:
 /* .IP "\fBsmtp_send_dummy_mail_auth (no)\fR"
 /*     Whether or not to append the "AUTH=<>" option to the MAIL
 /*     FROM command in SASL-authenticated SMTP sessions.
 /*     is available.
 /* .IP "\fBknown_tcp_ports (lmtp=24, smtp=25, smtps=submissions=465, submission=587)\fR"
 /*     Optional setting that avoids lookups in the \fBservices\fR(5) database.
+/* .PP
+/*     Available in Postfix version 3.7 and later:
+/* .IP "\fBsmtp_per_request_deadline (no)\fR"
+/*     Change the behavior of the smtp_*_timeout time limits, from a
+/*     time limit per plaintext or TLS read or write call, to a combined
+/*     time limit for sending a complete SMTP request and for receiving a
+/*     complete SMTP response.
+/* .IP "\fBsmtp_min_data_rate (500)\fR"
+/*     The minimum plaintext data transfer rate in bytes/second for
+/*     DATA requests, when deadlines are enabled with smtp_per_request_deadline.
 /* MIME PROCESSING CONTROLS
 /* .ad
 /* .fi
 /*     Time limit for connection cache connect, send or receive
 /*     operations.
 /* .PP
-/*     Available in Postfix version 2.9 and later:
+/*     Available in Postfix version 2.9 - 3.6:
 /* .IP "\fBsmtp_per_record_deadline (no)\fR"
 /*     Change the behavior of the smtp_*_timeout time limits, from a
 /*     time limit per read or write system call, to a time limit to send
 /* .IP "\fBsmtp_tls_connection_reuse (no)\fR"
 /*     Try to make multiple deliveries per TLS-encrypted connection.
 /* .PP
+/*     Available in Postfix version 3.7 and later:
+/* .IP "\fBsmtp_per_request_deadline (no)\fR"
+/*     Change the behavior of the smtp_*_timeout time limits, from a
+/*     time limit per plaintext or TLS read or write call, to a combined
+/*     time limit for sending a complete SMTP request and for receiving a
+/*     complete SMTP response.
+/* .IP "\fBsmtp_min_data_rate (500)\fR"
+/*     The minimum plaintext data transfer rate in bytes/second for
+/*     DATA requests, when deadlines are enabled with smtp_per_request_deadline.
+/* .PP
 /*     Implemented in the qmgr(8) daemon:
 /* .IP "\fBtransport_destination_concurrency_limit ($default_destination_concurrency_limit)\fR"
 /*     A transport-specific override for the
@@ -1049,11 +1071,12 @@ char   *var_smtp_resp_filter;
 bool    var_lmtp_assume_final;
 char   *var_smtp_dns_res_opt;
 char   *var_smtp_dns_support;
-bool    var_smtp_rec_deadline;
 bool    var_smtp_dummy_mail_auth;
 char   *var_smtp_dsn_filter;
 char   *var_smtp_dns_re_filter;
 bool    var_smtp_balance_inet_proto;
+bool    var_smtp_req_deadline;
+int     var_smtp_min_data_rate;
 
  /* Special handling of 535 AUTH errors. */
 char   *var_smtp_sasl_auth_cache_name;
@@ -1594,6 +1617,8 @@ int     main(int argc, char **argv)
                                           smtp_str_table : lmtp_str_table),
                       CA_MAIL_SERVER_BOOL_TABLE(smtp_mode ?
                                         smtp_bool_table : lmtp_bool_table),
+                      CA_MAIL_SERVER_NBOOL_TABLE(smtp_mode ?
+                                        smtp_nbool_table : lmtp_nbool_table),
                       CA_MAIL_SERVER_PRE_INIT(pre_init),
                       CA_MAIL_SERVER_POST_INIT(post_init),
                       CA_MAIL_SERVER_PRE_ACCEPT(pre_accept),
index 561f6a0ad32892857e271b9c813cd41000f518d7..493bfada1511f53b091d3c832c4606f605b43d79 100644 (file)
@@ -99,6 +99,7 @@
 #ifdef USE_TLS
        VAR_SMTP_TLS_SCERT_VD, DEF_SMTP_TLS_SCERT_VD, &var_smtp_tls_scert_vd, 0, 0,
 #endif
+       VAR_SMTP_MIN_DATA_RATE, DEF_SMTP_MIN_DATA_RATE, &var_smtp_min_data_rate, 1, 0,
        0,
     };
     static const CONFIG_BOOL_TABLE smtp_bool_table[] = {
        VAR_SMTP_CNAME_OVERR, DEF_SMTP_CNAME_OVERR, &var_smtp_cname_overr,
        VAR_SMTP_SASL_AUTH_SOFT_BOUNCE, DEF_SMTP_SASL_AUTH_SOFT_BOUNCE, &var_smtp_sasl_auth_soft_bounce,
        VAR_LMTP_ASSUME_FINAL, DEF_LMTP_ASSUME_FINAL, &var_lmtp_assume_final,
-       VAR_SMTP_REC_DEADLINE, DEF_SMTP_REC_DEADLINE, &var_smtp_rec_deadline,
        VAR_SMTP_DUMMY_MAIL_AUTH, DEF_SMTP_DUMMY_MAIL_AUTH, &var_smtp_dummy_mail_auth,
        VAR_SMTP_BALANCE_INET_PROTO, DEF_SMTP_BALANCE_INET_PROTO, &var_smtp_balance_inet_proto,
        0,
     };
+   static const CONFIG_NBOOL_TABLE smtp_nbool_table[] = {
+       VAR_SMTP_REQ_DEADLINE, DEF_SMTP_REQ_DEADLINE, &var_smtp_req_deadline,
+       0,
+   };
index 9287d319827cd2115c6d8de89042274a0905f7de..34afb3fee1848ede319978a43f133681ed1145c4 100644 (file)
@@ -337,7 +337,7 @@ int     smtp_helo(SMTP_STATE *state)
        /* XXX Mix-up of per-session and per-request flags. */
        state->misc_flags |= SMTP_MISC_FLAG_IN_STARTTLS;
        smtp_stream_setup(state->session->stream, var_smtp_starttls_tmout,
-                         var_smtp_rec_deadline);
+                         var_smtp_req_deadline, 0);
        tls_helo_status = smtp_start_tls(state);
        state->misc_flags &= ~SMTP_MISC_FLAG_IN_STARTTLS;
        return (tls_helo_status);
@@ -348,7 +348,7 @@ int     smtp_helo(SMTP_STATE *state)
      * Prepare for disaster.
      */
     smtp_stream_setup(state->session->stream, var_smtp_helo_tmout,
-                     var_smtp_rec_deadline);
+                     var_smtp_req_deadline, 0);
     if ((except = vstream_setjmp(state->session->stream)) != 0)
        return (smtp_stream_except(state, except, where));
 
@@ -764,7 +764,7 @@ int     smtp_helo(SMTP_STATE *state)
             * Prepare for disaster.
             */
            smtp_stream_setup(state->session->stream, var_smtp_starttls_tmout,
-                             var_smtp_rec_deadline);
+                             var_smtp_req_deadline, 0);
            if ((except = vstream_setjmp(state->session->stream)) != 0)
                return (smtp_stream_except(state, except,
                                        "receiving the STARTTLS response"));
@@ -1544,7 +1544,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
        msg_panic("%s: bad sender state %d (receiver state %d)",
                  myname, send_state, recv_state);
     smtp_stream_setup(session->stream, *xfer_timeouts[send_state],
-                     var_smtp_rec_deadline);
+                     var_smtp_req_deadline, 0);
     if ((except = vstream_setjmp(session->stream)) != 0) {
        msg_warn("smtp_proto: spurious flush before read in send state %d",
                 send_state);
@@ -1931,7 +1931,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
 #define LOST_CONNECTION_INSIDE_DATA (except == SMTP_ERR_EOF)
 
                smtp_stream_setup(session->stream, *xfer_timeouts[recv_state],
-                                 var_smtp_rec_deadline);
+                                 var_smtp_req_deadline, 0);
                if (LOST_CONNECTION_INSIDE_DATA) {
                    if (vstream_setjmp(session->stream) != 0)
                        RETURN(smtp_stream_except(state, SMTP_ERR_EOF,
@@ -2266,7 +2266,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state,
        if (send_state == SMTP_STATE_DOT && nrcpt > 0) {
 
            smtp_stream_setup(session->stream, var_smtp_data1_tmout,
-                             var_smtp_rec_deadline);
+                             var_smtp_req_deadline, var_smtp_min_data_rate);
 
            if ((except = vstream_setjmp(session->stream)) == 0) {
 
index 82e1ad2fbb21a9ea8f5502a50a8cf06e0f01f942..7a51de67437512aa0ac92b7f8e96f956ab20de57 100644 (file)
 /* .IP "\fBsmtpd_command_filter (empty)\fR"
 /*     A mechanism to transform commands from remote SMTP clients.
 /* .PP
-/*     Available in Postfix version 2.9 and later:
+/*     Available in Postfix version 2.9 - 3.6:
 /* .IP "\fBsmtpd_per_record_deadline (normal: no, overload: yes)\fR"
 /*     Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
 /*     time limits, from a
 /*     Evaluate smtpd_relay_restrictions before smtpd_recipient_restrictions.
 /* .IP "\fBknown_tcp_ports (lmtp=24, smtp=25, smtps=submissions=465, submission=587)\fR"
 /*     Optional setting that avoids lookups in the \fBservices\fR(5) database.
+/* .PP
+/*     Available in Postfix version 3.7 and later:
+/* .IP "\fBsmtpd_per_request_deadline (normal: no, overload: yes)\fR"
+/*     Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
+/*     time limits, from a time limit per plaintext or TLS read or write
+/*     call, to a combined time limit for receiving a complete SMTP request
+/*     and for sending a complete SMTP response.
+/* .IP "\fBsmtpd_min_data_rate (500)\fR"
+/*     The minimum plaintext data transfer rate in bytes/second for
+/*     DATA and BDAT requests, when deadlines are enabled with
+/*     smtpd_per_request_deadline.
 /* ADDRESS REWRITING CONTROLS
 /* .ad
 /* .fi
 /*     remote SMTP client is allowed to negotiate with this service per
 /*     time unit.
 /* .PP
-/*     Available in Postfix version 2.9 and later:
+/*     Available in Postfix version 2.9 - 3.6:
 /* .IP "\fBsmtpd_per_record_deadline (normal: no, overload: yes)\fR"
 /*     Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
 /*     time limits, from a
 /*     The maximal number of AUTH commands that any client is allowed to
 /*     send to this service per time unit, regardless of whether or not
 /*     Postfix actually accepts those commands.
+/* .PP
+/*     Available in Postfix version 3.7 and later:
+/* .IP "\fBsmtpd_per_request_deadline (normal: no, overload: yes)\fR"
+/*     Change the behavior of the smtpd_timeout and smtpd_starttls_timeout
+/*     time limits, from a time limit per plaintext or TLS read or write
+/*     call, to a combined time limit for receiving a complete SMTP request
+/*     and for sending a complete SMTP response.
+/* .IP "\fBsmtpd_min_data_rate (500)\fR"
+/*     The minimum plaintext data transfer rate in bytes/second for
+/*     DATA and BDAT requests, when deadlines are enabled with
+/*     smtpd_per_request_deadline.
 /* TARPIT CONTROLS
 /* .ad
 /* .fi
@@ -1458,7 +1480,6 @@ char   *var_unk_name_tf_act;
 char   *var_unk_addr_tf_act;
 char   *var_unv_rcpt_tf_act;
 char   *var_unv_from_tf_act;
-bool    var_smtpd_rec_deadline;
 
 int     smtpd_proxy_opts;
 
@@ -1470,6 +1491,8 @@ char   *var_tlsproxy_service;
 char   *var_smtpd_uproxy_proto;
 int     var_smtpd_uproxy_tmout;
 bool    var_relay_before_rcpt_checks;
+bool    var_smtpd_req_deadline;
+int     var_smtpd_min_data_rate;
 
  /*
   * Silly little macros.
@@ -3506,6 +3529,13 @@ static void receive_data_message(SMTPD_STATE *state,
     int     prev_rec_type;
     int     first = 1;
 
+    /*
+     * If deadlines are enabled, increase the time budget as message content
+     * arrives.
+     */
+    smtp_stream_setup(state->client, var_smtpd_tmout, var_smtpd_req_deadline,
+                     var_smtpd_min_data_rate);
+
     /*
      * Copy the message content. If the cleanup process has a problem, keep
      * reading until the remote stops sending, then complain. Produce typed
@@ -3846,6 +3876,13 @@ static int bdat_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
        return (-1);
     }
 
+    /*
+     * If deadlines are enabled, increase the time budget as message content
+     * arrives.
+     */
+    smtp_stream_setup(state->client, var_smtpd_tmout, var_smtpd_req_deadline,
+                     var_smtpd_min_data_rate);
+
     /*
      * Block abuse involving empty chunks (alternatively, we could count
      * "BDAT 0" as a "NOOP", but then we would have to refactor the code that
@@ -5413,11 +5450,14 @@ static void smtpd_proto(SMTPD_STATE *state)
      * memory, panic) the error is logged, and the msg_cleanup() exit handler
      * cleans up, but no attempt is made to inform the client of the nature
      * of the problem.
+     * 
+     * With deadlines enabled, do not increase the time budget while receiving a
+     * command, because that would give an attacker too much time.
      */
-    smtp_stream_setup(state->client, var_smtpd_tmout, var_smtpd_rec_deadline);
-
+    vstream_control(state->client, VSTREAM_CTL_EXCEPT, VSTREAM_CTL_END);
     while ((status = vstream_setjmp(state->client)) == SMTP_ERR_NONE)
         /* void */ ;
+    smtp_stream_setup(state->client, var_smtpd_tmout, var_smtpd_req_deadline, 0);
     switch (status) {
 
     default:
@@ -5642,6 +5682,8 @@ static void smtpd_proto(SMTPD_STATE *state)
        for (;;) {
            if (state->flags & SMTPD_FLAG_HANGUP)
                break;
+           smtp_stream_setup(state->client, var_smtpd_tmout,
+                             var_smtpd_req_deadline, 0);
            if (state->error_count >= var_smtpd_hard_erlim) {
                state->reason = REASON_ERROR_LIMIT;
                state->error_mask |= MAIL_ERROR_PROTOCOL;
@@ -6372,6 +6414,7 @@ int     main(int argc, char **argv)
        VAR_SMTPD_SASL_RESP_LIMIT, DEF_SMTPD_SASL_RESP_LIMIT, &var_smtpd_sasl_resp_limit, DEF_SMTPD_SASL_RESP_LIMIT, 0,
        VAR_SMTPD_POLICY_REQ_LIMIT, DEF_SMTPD_POLICY_REQ_LIMIT, &var_smtpd_policy_req_limit, 0, 0,
        VAR_SMTPD_POLICY_TRY_LIMIT, DEF_SMTPD_POLICY_TRY_LIMIT, &var_smtpd_policy_try_limit, 1, 0,
+       VAR_SMTPD_MIN_DATA_RATE, DEF_SMTPD_MIN_DATA_RATE, &var_smtpd_min_data_rate, 1, 0,
        0,
     };
     static const CONFIG_LONG_TABLE long_table[] = {
@@ -6425,8 +6468,8 @@ int     main(int argc, char **argv)
        0,
     };
     static const CONFIG_NBOOL_TABLE nbool_table[] = {
-       VAR_SMTPD_REC_DEADLINE, DEF_SMTPD_REC_DEADLINE, &var_smtpd_rec_deadline,
        VAR_RELAY_BEFORE_RCPT_CHECKS, DEF_RELAY_BEFORE_RCPT_CHECKS, &var_relay_before_rcpt_checks,
+       VAR_SMTPD_REQ_DEADLINE, DEF_SMTPD_REQ_DEADLINE, &var_smtpd_req_deadline,
        0,
     };
     static const CONFIG_STR_TABLE str_table[] = {
index 39a2a8227ac800fe2d25379ca042de3dedc696ed..a2a01b77c4645566a203482eaa20c495562336ab 100644 (file)
@@ -1356,6 +1356,12 @@ static void tlsp_get_request_event(int event, void *context)
     /*
      * Receive the initial request attributes. Receive the remainder after we
      * figure out what role we are expected to play.
+     * 
+     * The tlsproxy server does not enforce per-request read/write deadlines or
+     * minimal data rates. Instead, the tlsproxy server relies on the
+     * tlsproxy client to enforce these context-dependent limits. When a
+     * tlsproxy client decides to time out, it will close its end of the
+     * tlsproxy stream, and the tlsproxy server will handle that immediately.
      */
     if (event != EVENT_READ
        || attr_scan(plaintext_stream, ATTR_FLAG_STRICT,
index eb56c897917908063f144bdc104ef6766b3e3b6d..b4f9fbb677d418120f25d543d439fb488e4b7e2c 100644 (file)
 /*     buffer, reads the bytes from the specified VSTREAM, and
 /*     adjusts the buffer write position. The buffer is NOT
 /*     null-terminated. The result value is as with vstream_fread().
-/*      NOTE: do not skip calling vstream_fread_buf() when len == 0.
-/*      This function has side effects including resetting the buffer
-/*      write position, and skipping the call would invalidate the
-/*      buffer state.
+/*     NOTE: do not skip calling vstream_fread_buf() when len == 0.
+/*     This function has side effects including resetting the buffer
+/*     write position, and skipping the call would invalidate the
+/*     buffer state.
 /*
 /*     vstream_fread_app() is like vstream_fread_buf() but appends
 /*     to existing buffer content, instead of writing over it.
 /*     buffer, so that the result of some %letter specifiers can
 /*     be written to contiguous memory.
 /* .IP CA_VSTREAM_CTL_START_DEADLINE (no arguments)
-/*     Change the VSTREAM_CTL_TIMEOUT behavior, to limit the total
-/*     time for all subsequent file descriptor read or write
-/*     operations, and recharge the deadline timer.
+/*     Change the VSTREAM_CTL_TIMEOUT behavior, to a deadline for
+/*     the total amount of time for all subsequent file descriptor
+/*     read or write operations, and recharge the deadline timer.
 /* .IP CA_VSTREAM_CTL_STOP_DEADLINE (no arguments)
 /*     Revert VSTREAM_CTL_TIMEOUT behavior to the default, i.e.
 /*     a time limit for individual file descriptor read or write
 /*     operations.
+/* .IP CA_VSTREAM_CTL_MIN_DATA_RATE (int)
+/*     When the DEADLINE is enabled, the amount of data that must
+/*     be transferred to add 1 second to the deadline. However,
+/*     the deadline will never exceed the timeout specified with
+/*     VSTREAM_CTL_TIMEOUT. A zero value requests no update to the
+/*     deadline as data is transferred; that is appropriate for
+/*     request/reply interactions.
 /* .IP CA_VSTREAM_CTL_OWN_VSTRING (no arguments)
 /*     Transfer ownership of the VSTRING that was opened with
 /*     vstream_memopen() etc. to the stream, so that the VSTRING
@@ -656,6 +663,16 @@ VSTREAM vstream_fstd[] = {
        } \
     } while (0)
 
+#define VSTREAM_ADD_TIME(x, y, z) \
+    do { \
+       (x).tv_sec = (y).tv_sec + (z).tv_sec; \
+       (x).tv_usec = (y).tv_usec + (z).tv_usec; \
+       while ((x).tv_usec >= 1000000) { \
+           (x).tv_usec -= 1000000; \
+           (x).tv_sec += 1; \
+       } \
+    } while (0)
+
 /* vstream_buf_init - initialize buffer */
 
 static void vstream_buf_init(VBUF *bp, int flags)
@@ -729,6 +746,7 @@ static int vstream_fflush_some(VSTREAM *stream, ssize_t to_flush)
     int     timeout;
     struct timeval before;
     struct timeval elapsed;
+    struct timeval bonus;
 
     /*
      * Sanity checks. It is illegal to flush a read-only stream. Otherwise,
@@ -802,6 +820,17 @@ static int vstream_fflush_some(VSTREAM *stream, ssize_t to_flush)
            if (bp->flags & VSTREAM_FLAG_DEADLINE) {
                VSTREAM_SUB_TIME(elapsed, stream->iotime, before);
                VSTREAM_SUB_TIME(stream->time_limit, stream->time_limit, elapsed);
+               if (stream->min_data_rate > 0) {
+                   bonus.tv_sec = n / stream->min_data_rate;
+                   bonus.tv_usec = (n % stream->min_data_rate) * 1000000;
+                   bonus.tv_usec /= stream->min_data_rate;
+                   VSTREAM_ADD_TIME(stream->time_limit, stream->time_limit,
+                                    bonus);
+                   if (stream->time_limit.tv_sec >= stream->timeout) {
+                       stream->time_limit.tv_sec = stream->timeout;
+                       stream->time_limit.tv_usec = 0;
+                   }
+               }
            }
        }
        if (msg_verbose > 2 && stream != VSTREAM_ERR && n != to_flush)
@@ -866,6 +895,7 @@ static int vstream_buf_get_ready(VBUF *bp)
     ssize_t n;
     struct timeval before;
     struct timeval elapsed;
+    struct timeval bonus;
     int     timeout;
 
     /*
@@ -967,6 +997,17 @@ static int vstream_buf_get_ready(VBUF *bp)
            if (bp->flags & VSTREAM_FLAG_DEADLINE) {
                VSTREAM_SUB_TIME(elapsed, stream->iotime, before);
                VSTREAM_SUB_TIME(stream->time_limit, stream->time_limit, elapsed);
+               if (stream->min_data_rate > 0) {
+                   bonus.tv_sec = n / stream->min_data_rate;
+                   bonus.tv_usec = (n % stream->min_data_rate) * 1000000;
+                   bonus.tv_usec /= stream->min_data_rate;
+                   VSTREAM_ADD_TIME(stream->time_limit, stream->time_limit,
+                                    bonus);
+                   if (stream->time_limit.tv_sec >= stream->timeout) {
+                       stream->time_limit.tv_sec = stream->timeout;
+                       stream->time_limit.tv_usec = 0;
+                   }
+               }
            }
        }
        if (msg_verbose > 2)
@@ -1307,6 +1348,7 @@ static VSTREAM *vstream_subopen(void)
     stream->time_limit.tv_sec = stream->time_limit.tv_usec = 0;
     stream->req_bufsize = 0;
     stream->vstring = 0;
+    stream->min_data_rate = 0;
     return (stream);
 }
 
@@ -1531,6 +1573,7 @@ void    vstream_control(VSTREAM *stream, int name,...)
     int     old_fd;
     ssize_t req_bufsize = 0;
     VSTREAM *stream2;
+    int     min_data_rate;
 
 #define SWAP(type,a,b) do { type temp = (a); (a) = (b); (b) = (temp); } while (0)
 
@@ -1675,6 +1718,12 @@ void    vstream_control(VSTREAM *stream, int name,...)
            stream->time_limit.tv_sec = stream->timeout;
            stream->time_limit.tv_usec = 0;
            break;
+       case VSTREAM_CTL_MIN_DATA_RATE:
+           min_data_rate = va_arg(ap, int);
+           if (min_data_rate < 0)
+               msg_panic("%s: bad min_data_rate %d", myname, min_data_rate);
+           stream->min_data_rate = min_data_rate;
+           break;
        case VSTREAM_CTL_OWN_VSTRING:
            if ((stream->buf.flags |= VSTREAM_FLAG_MEMORY) == 0)
                msg_panic("%s: operation on non-VSTRING stream", myname);
index 3a363cc17a2e1deed4f129934253d5a2d3e7b86f..23688c745330da3fe951d4a969ee676f32e64dd5 100644 (file)
@@ -59,6 +59,7 @@ typedef struct VSTREAM {
     VSTREAM_JMP_BUF *jbuf;             /* exception handling */
     struct timeval iotime;             /* time of last fill/flush */
     struct timeval time_limit;         /* read/write time limit */
+    int     min_data_rate;             /* min data rate for time limit */
     struct VSTRING *vstring;           /* memory-backed stream */
 } VSTREAM;
 
@@ -157,6 +158,7 @@ extern void vstream_control(VSTREAM *, int,...);
 #define VSTREAM_CTL_START_DEADLINE 14
 #define VSTREAM_CTL_STOP_DEADLINE 15
 #define VSTREAM_CTL_OWN_VSTRING        16
+#define VSTREAM_CTL_MIN_DATA_RATE 17
 
 /* Safer API: type-checked arguments, external use. */
 #define CA_VSTREAM_CTL_END             VSTREAM_CTL_END
@@ -177,7 +179,7 @@ extern void vstream_control(VSTREAM *, int,...);
 #define CA_VSTREAM_CTL_SWAP_FD(v)      VSTREAM_CTL_SWAP_FD, CHECK_PTR(VSTREAM_CTL, VSTREAM, (v))
 #define CA_VSTREAM_CTL_START_DEADLINE  VSTREAM_CTL_START_DEADLINE
 #define CA_VSTREAM_CTL_STOP_DEADLINE   VSTREAM_CTL_STOP_DEADLINE
-#define CA_VSTREAM_CTL_OWN_VSTRING     VSTREAM_CTL_OWN_VSTRING
+#define CA_VSTREAM_CTL_MIN_DATA_RATE(v)        VSTREAM_CTL_MIN_DATA_RATE, CHECK_VAL(VSTREAM_CTL, int, (v))
 
 CHECK_VAL_HELPER_DCL(VSTREAM_CTL, ssize_t);
 CHECK_VAL_HELPER_DCL(VSTREAM_CTL, int);