1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 4<html> 5 6<head> 7 8<title>Postfix BDAT (CHUNKING) support</title> 9 10<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 11<link rel='stylesheet' type='text/css' href='postfix-doc.css'> 12 13</head> 14 15<body> 16 17<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix 18BDAT (CHUNKING) support</h1> 19 20<hr> 21 22<h2>Overview </h2> 23 24<p> Postfix SMTP server supports RFC 3030 CHUNKING (the BDAT command) 25without BINARYMIME, in both smtpd(8) and postscreen(8). It is enabled 26by default. </p> 27 28<p> Topics covered in this document: </p> 29 30<ul> 31 32<li><a href="#disable"> Disabling BDAT support</a> 33 34<li><a href="#impact"> Impact on existing configurations</a> 35 36<li><a href="#example"> Example SMTP session</a> 37 38<li> <a href="#benefits">Benefits of CHUNKING (BDAT) support without BINARYMIME</a> 39 40<li> <a href="#downsides">Downsides of CHUNKING (BDAT) support</a> 41 42</ul> 43 44<h2> <a name="disable"> Disabling BDAT support </a> </h2> 45 46<p> BDAT support is enabled by default. To disable BDAT support 47globally: </p> 48 49<blockquote> 50<pre> 51/etc/postfix/main.cf: 52 # The logging alternative: 53 smtpd_discard_ehlo_keywords = chunking 54 # The non-logging alternative: 55 smtpd_discard_ehlo_keywords = chunking, silent-discard 56</pre> 57</blockquote> 58 59<p> Specify '-o smtpd_discard_ehlo_keywords=' in master.cf 60for the submission and smtps services, if you have clients 61that benefit from CHUNKING support. </p> 62 63<h2> <a name="impact"> Impact on existing configurations </a> </h2> 64 65<ul> 66 67<li> <p> There are no changes for smtpd_mumble_restrictions, 68smtpd_proxy_filter, smtpd_milters, or for postscreen settings, 69except for the above mentioned option to suppress the SMTP server's 70CHUNKING service announcement. </p> 71 72<li> <p> There are no changes in the Postfix queue file content, 73no changes for down-stream SMTP servers or after-queue content 74filters, and no changes in the envelope or message content that 75Milters will receive. </p> 76 77</ul> 78 79<h2> <a name="example"> Example SMTP session</a> </h2> 80 81<p> The main differences are that the Postfix SMTP server announces 82"CHUNKING" support in the EHLO response, and that instead of sending 83one DATA request, the remote SMTP client may send one or more BDAT 84requests. In the example below, "S:" indicates server responses, 85and "C:" indicates client requests (bold font). </p> 86 87<blockquote> 88<pre> 89 S: 220 server.example.com 90 C: <b>EHLO client.example.com</b> 91 S: 250-server.example.com 92 S: 250-PIPELINING 93 S: 250-SIZE 153600000 94 S: 250-VRFY 95 S: 250-ETRN 96 S: 250-STARTTLS 97 S: 250-AUTH PLAIN LOGIN 98 S: 250-ENHANCEDSTATUSCODES 99 S: 250-8BITMIME 100 S: 250-DSN 101 S: 250-SMTPUTF8 102 S: 250 CHUNKING 103 C: <b>MAIL FROM:<sender@example.com></b> 104 S: 250 2.1.0 Ok 105 C: <b>RCPT TO:<recipient@example.com></b> 106 S: 250 2.1.5 Ok 107 C: <b>BDAT 10000</b> 108 C: <b>..followed by 10000 bytes...</b> 109 S: 250 2.0.0 Ok: 10000 bytes 110 C: <b>BDAT 123</b> 111 C: <b>..followed by 123 bytes...</b> 112 S: 250 2.0.0 Ok: 123 bytes 113 C: <b>BDAT 0 LAST</b> 114 S: 250 2.0.0 Ok: 10123 bytes queued as 41yYhh41qmznjbD 115 C: <b>QUIT</b> 116 S: 221 2.0.0 Bye 117</pre> 118</blockquote> 119 120<p> Internally in Postfix, there is no difference between mail that 121was received with BDAT or with DATA. Postfix smtpd_mumble_restrictions, 122policy delegation queries, smtpd_proxy_filter and Milters all behave 123as if Postfix received (MAIL + RCPT + DATA + end-of-data). However, 124Postfix will log BDAT-related failures as "xxx after BDAT" to avoid 125complicating troubleshooting (xxx = 'lost connection' or 'timeout'), 126and will log a warning when a client sends a malformed BDAT command. 127</p> 128 129<h2> <a name="benefits">Benefits of CHUNKING (BDAT) support without 130BINARYMIME</a> </h2> 131 132<p> Support for CHUNKING (BDAT) was added to improve interoperability 133with some clients, a benefit that would reportedly exist even without 134Postfix support for BINARYMIME. Since June 2018, Wietse's mail 135server has received BDAT commands from a variety of systems. </p> 136 137<p> Postfix does not support BINARYMIME at this time because: </p> 138 139<ul> 140 141<li> <p> BINARYMIME support would require moderately invasive 142changes to Postfix, to support email content that is not line-oriented. 143With BINARYMIME, the Content-Length: message header specifies the 144length of content that may or may not have line boundaries. Without 145BINARYMIME support, email RFCs require that binary content is 146base64-encoded, and formatted as lines of text. </p> 147 148<li> <p> For delivery to non-BINARYMIME systems including UNIX mbox, 149the available options are to convert binary content into 8bit text, 150one of the 7bit forms (base64 or quoted-printable), or to return 151email as undeliverable. Any conversion would obviously break digital 152signatures, so conversion would have to happen before signing. </p> 153 154</ul> 155 156<h2> <a name="downsides">Downsides of CHUNKING (BDAT) support</a> 157</h2> 158 159<p> The RFC 3030 authors did not specify any limitations on how 160clients may pipeline commands (i.e. send commands without waiting 161for a server response). If a server announces PIPELINING support, 162like Postfix does, then a remote SMTP client can pipeline all 163commands following EHLO, for example, MAIL/RCPT/BDAT/BDAT/MAIL/RCPT/BDAT, 164without ever having to wait for a server response. This means that 165with BDAT, the Postfix SMTP server cannot distinguish between a 166well-behaved client and a spambot, based on their command pipelining 167behavior. If you require "reject_unauth_pipelining" to block spambots, 168then turn off Postfix's CHUNKING announcement as described above. 169</p> 170 171<p> In RFC 4468, the authors write that a client may pipeline 172commands, and that after sending BURL LAST or BDAT LAST, a client 173must wait for the server's response. But as this text does not 174appear in RFC 3030 which defines BDAT, it is a useless restriction 175that Postfix will not enforce. </p> 176 177</body> 178 179</html> 180