skip to content

For an internet-facing MX you run, would you reject or normalise SMTP lines that end in a bare LF, and which clients would you exempt?

level: principalimportance: nice to knowfreq 9%

answer

  1. protection against compatibility
  2. measure before you enforce
  3. standard end of data either way
  4. trusted networks get exclusions

basics

~20 s

Both require the standard CR LF . CR LF end of data, which closes SMTP smuggling. Normalising keeps mixed-line-ending senders working; rejecting also refuses scripts, web applications and health checks. Measure first; exempt only trusted internal clients.

solid answer

~40 s

The protective part is the same in both modes: only `CR LF . CR LF` ends the data. In Postfix terms, `normalize`, the default from 3.9, accepts lines ending in a bare `LF` as if they ended in `CR LF`, while `reject` refuses any command or content with a bare `LF` using `smtpd_forbid_bare_newline_reject_code`, `550` by default. Postfix's documentation warns that `reject` will refuse mail from web applications, simple scripts, load-balancer health checks and services that send bare newlines over `BDAT`, mostly senders you do not control. My default for a public MX is `normalize`, after a period on `note` to see who sends bare LF. I would choose `reject` only where the traffic is known. Exemptions go through `smtpd_forbid_bare_newline_exclusions`, `$mynetworks` by default, kept narrow and for clients you own.

code

ini · 9 lines
ini
# Postfix 3.9 main.cf, internet-facing MX
# Stage 1: protect and measure (logs notes=bare_lf)
smtpd_forbid_bare_newline = note
smtpd_forbid_bare_newline_exclusions = $mynetworks
# Stage 2, chosen after measuring:
# smtpd_forbid_bare_newline = normalize
# or, for a listener with known clients:
# smtpd_forbid_bare_newline = reject
# smtpd_forbid_bare_newline_reject_code = 550

go deeper

for a junior

Recall that bare LF means a line ending without CR, and that a public MX should accept only the standard end of data.

for a middle

Explain how normalize, note and reject differ in Postfix and which one became the default in Postfix 3.9.

for a senior

Read notes=bare_lf and bare <LF> received log lines, find which senders trip the rule, and handle BDAT senders without widening exemptions.

for a principal

Choose the public default and the exemption policy, state the cost in refused legitimate mail, and plan the review triggers and the outbound fix.

## The decision After the 2023 SMTP smuggling disclosures, every operator of an internet-facing MX has to choose how strictly to apply RFC 5321 2.3.8, which says a line ends only in `CR LF`. Two things are at stake: - **Protection**: the server must never accept anything but the standard `CR LF . CR LF` as the end of message data. - **Compatibility**: plenty of legitimate software still sends lines that end in a bare `LF`, and on an MX most of those senders belong to other people. The RFC tells clients what not to send; it leaves the receiver to decide what to accept. Postfix, the reference MTA here, turns that decision into one setting with four useful values. ## The options | Postfix value | End of data | Line ending in a bare `LF` | Since | |---|---|---|---| | `no` | non-standard variants also accepted | treated as `CR LF` | default before 3.9 | | `normalize` (alias `yes`) | standard only | treated as `CR LF` | 3.8.5 / 3.7.10 / 3.6.14 / 3.5.24; default in 3.9 | | `note` | standard only | treated as `CR LF`, session logged with `notes=bare_lf` | 3.9 | | `reject` | standard only | command or message refused, `bare <LF> received` logged | 3.8.5 / 3.7.10 / 3.6.14 / 3.5.24 | The value `yes` itself arrived in 3.8.4, 3.7.9, 3.6.13 and 3.5.23 and is now an alias for `normalize`. `no` is the exposed setting and has no place on a public listener. ## What each choice costs **Normalise** keeps working with clients that mix standard and non-standard line ends. Postfix's documentation is explicit about what it still refuses: mail from a client that does not end its data with the standard sequence, which will not be received. **Reject** is the literal reading of the RFC, and Postfix lists who it hurts: - web applications and simple scripts that write `LF` line ends; - load-balancer health checks; - services that send MIME text containing a bare newline with `BDAT`, which RFC 3030 forbids because text sent that way must be in canonical `CR LF` form. The rejection code comes from `smtpd_forbid_bare_newline_reject_code`, `550` by default, or `521` to disconnect. A permanent refusal turns into a bounce at a sender you may never hear from directly, which is how the policy shows up as lost mail. ## How I would decide 1. **Measure first.** On Postfix 3.9, run `note` for a few weeks: it already protects like `normalize` and tags every session that sent a bare `LF`. Count those sessions by client. 2. **Classify the senders.** Separate your own applications and devices from outside senders. Outside senders that trip the rule are the real cost of `reject`. 3. **Pick the public default.** For a general-purpose MX, `normalize` closes the smuggling path at the lowest compatibility cost. `reject` fits a listener whose clients are known, such as one serving partners who have confirmed their line endings. 4. **Keep exemptions narrow.** `smtpd_forbid_bare_newline_exclusions` defaults to `$mynetworks`. A broad `mynetworks` quietly widens the exemption, so review it, and prefer moving old internal senders to a separate submission listener over widening the public one. 5. **Handle BDAT separately.** If only `BDAT` senders trip `reject`, Postfix can stop offering `chunking` to those addresses with `smtpd_discard_ehlo_keyword_address_maps`, or to everyone with `smtpd_discard_ehlo_keywords`, instead of loosening the line rule. 6. **Fix your own outbound side.** Whatever you accept, make sure what you relay leaves with `CR LF` line ends, since RFC 5321 forbids clients to send anything else. ## When to revisit - An MTA upgrade that changes the default, as Postfix 3.9 did. - A rise in `notes=bare_lf` sessions from one client range, which points at a sender to contact. - A partner or regulator asking for strict conformance on a dedicated listener. - A new disclosure about how mail services frame message data, which is a reason to re-read your MTA's release notes before the next change freeze rather than after it. ## The trade-off in one line `normalize` and `reject` close the same hole; the choice between them is how much legitimate but sloppy mail the domain is willing to refuse, and exemptions are a debt to pay down, not a setting to grow.

  • Does normalize leave the server open to smuggling because it still accepts bare LF lines?
    No. The smuggling flaw depends on a non-standard sequence being taken as the end of data. `normalize` requires the standard `CR LF . CR LF` to end the data and only treats other bare-LF lines as ordinary line ends, which Postfix's notes say stops the smuggling attacks against recipients on that server.
  • A partner's mail is refused after you set reject. What do you check before exempting them?
    The log for `bare <LF> received`, whether it comes from `BDAT` traffic, and whether the partner can fix its line endings. If only `BDAT` is the problem, stop offering `chunking` to their addresses rather than adding them to `smtpd_forbid_bare_newline_exclusions`, and set a date to review any exemption you do grant.

  • Only reject protects against smuggling; normalize does not.
  • RFC 5321 requires servers to reject every bare LF they receive.
  • Widening mynetworks is a harmless way to silence bare-LF errors.
  • Leaving the value at no is acceptable on an internet-facing MX.
  • Rejected bare-LF mail only affects attackers, never real senders.