header_checks revision 1.1.1.6 1 1.1 tron #++
2 1.1 tron # NAME
3 1.1 tron # header_checks 5
4 1.1 tron # SUMMARY
5 1.1 tron # Postfix built-in content inspection
6 1.1 tron # SYNOPSIS
7 1.1 tron # .nf
8 1.1 tron # \fBheader_checks = pcre:/etc/postfix/header_checks\fR
9 1.1 tron # \fBmime_header_checks = pcre:/etc/postfix/mime_header_checks\fR
10 1.1 tron # \fBnested_header_checks = pcre:/etc/postfix/nested_header_checks\fR
11 1.1 tron # \fBbody_checks = pcre:/etc/postfix/body_checks\fR
12 1.1 tron # .sp
13 1.1.1.3 tron # \fBmilter_header_checks = pcre:/etc/postfix/milter_header_checks\fR
14 1.1.1.3 tron # .sp
15 1.1.1.3 tron # \fBsmtp_header_checks = pcre:/etc/postfix/smtp_header_checks\fR
16 1.1.1.3 tron # \fBsmtp_mime_header_checks = pcre:/etc/postfix/smtp_mime_header_checks\fR
17 1.1.1.3 tron # \fBsmtp_nested_header_checks = pcre:/etc/postfix/smtp_nested_header_checks\fR
18 1.1.1.3 tron # \fBsmtp_body_checks = pcre:/etc/postfix/smtp_body_checks\fR
19 1.1.1.3 tron # .sp
20 1.1 tron # \fBpostmap -q "\fIstring\fB" pcre:/etc/postfix/\fIfilename\fR
21 1.1 tron # \fBpostmap -q - pcre:/etc/postfix/\fIfilename\fR <\fIinputfile\fR
22 1.1 tron # .fi
23 1.1 tron # DESCRIPTION
24 1.1 tron # This document describes access control on the content of
25 1.1 tron # message headers and message body lines; it is implemented
26 1.1 tron # by the Postfix \fBcleanup\fR(8) server before mail is queued.
27 1.1 tron # See \fBaccess\fR(5) for access control on remote SMTP client
28 1.1 tron # information.
29 1.1 tron #
30 1.1 tron # Each message header or message body line is compared against
31 1.1 tron # a list of patterns.
32 1.1 tron # When a match is found the corresponding action is executed, and
33 1.1 tron # the matching process is repeated for the next message header or
34 1.1 tron # message body line.
35 1.1 tron #
36 1.1.1.3 tron # Note: message headers are examined one logical header at a time,
37 1.1.1.3 tron # even when a message header spans multiple lines. Body lines are
38 1.1.1.3 tron # always examined one line at a time.
39 1.1.1.3 tron #
40 1.1 tron # For examples, see the EXAMPLES section at the end of this
41 1.1 tron # manual page.
42 1.1 tron #
43 1.1 tron # Postfix header or body_checks are designed to stop a flood of mail
44 1.1 tron # from worms or viruses; they do not decode attachments, and they do
45 1.1 tron # not unzip archives. See the documents referenced below in the README
46 1.1 tron # FILES section if you need more sophisticated content analysis.
47 1.1.1.3 tron # FILTERS WHILE RECEIVING MAIL
48 1.1.1.3 tron # .ad
49 1.1.1.3 tron # .fi
50 1.1.1.3 tron # Postfix implements the following four built-in content
51 1.1.1.3 tron # inspection classes while receiving mail:
52 1.1.1.3 tron # .IP "\fBheader_checks\fR (default: empty)"
53 1.1 tron # These are applied to initial message headers (except for
54 1.1 tron # the headers that are processed with \fBmime_header_checks\fR).
55 1.1 tron # .IP "\fBmime_header_checks\fR (default: \fB$header_checks\fR)"
56 1.1 tron # These are applied to MIME related message headers only.
57 1.1 tron # .sp
58 1.1 tron # This feature is available in Postfix 2.0 and later.
59 1.1 tron # .IP "\fBnested_header_checks\fR (default: \fB$header_checks\fR)"
60 1.1 tron # These are applied to message headers of attached email
61 1.1 tron # messages (except for the headers that are processed with
62 1.1 tron # \fBmime_header_checks\fR).
63 1.1 tron # .sp
64 1.1 tron # This feature is available in Postfix 2.0 and later.
65 1.1 tron # .IP \fBbody_checks\fR
66 1.1 tron # These are applied to all other content, including multi-part
67 1.1 tron # message boundaries.
68 1.1 tron # .sp
69 1.1 tron # With Postfix versions before 2.0, all content after the initial
70 1.1 tron # message headers is treated as body content.
71 1.1.1.3 tron # FILTERS AFTER RECEIVING MAIL
72 1.1.1.3 tron # .ad
73 1.1.1.3 tron # .fi
74 1.1.1.3 tron # Postfix supports a subset of the built-in content inspection
75 1.1.1.3 tron # classes after the message is received:
76 1.1.1.3 tron # .IP "\fBmilter_header_checks\fR (default: empty)"
77 1.1.1.3 tron # These are applied to headers that are added with Milter
78 1.1.1.3 tron # applications.
79 1.1.1.3 tron # .sp
80 1.1.1.3 tron # This feature is available in Postfix 2.7 and later.
81 1.1.1.3 tron # FILTERS WHILE DELIVERING MAIL
82 1.1.1.3 tron # .ad
83 1.1.1.3 tron # .fi
84 1.1.1.3 tron # Postfix supports all four content inspection classes while
85 1.1.1.3 tron # delivering mail via SMTP.
86 1.1.1.3 tron # .IP "\fBsmtp_header_checks\fR (default: empty)"
87 1.1.1.3 tron # .IP "\fBsmtp_mime_header_checks\fR (default: empty)"
88 1.1.1.3 tron # .IP "\fBsmtp_nested_header_checks\fR (default: empty)"
89 1.1.1.3 tron # .IP "\fBsmtp_body_checks\fR (default: empty)"
90 1.1.1.3 tron # These features are available in Postfix 2.5 and later.
91 1.1 tron # COMPATIBILITY
92 1.1 tron # .ad
93 1.1 tron # .fi
94 1.1.1.2 tron # With Postfix version 2.2 and earlier specify "\fBpostmap
95 1.1.1.2 tron # -fq\fR" to query a table that contains case sensitive
96 1.1.1.2 tron # patterns. By default, regexp: and pcre: patterns are case
97 1.1.1.2 tron # insensitive.
98 1.1 tron # TABLE FORMAT
99 1.1 tron # .ad
100 1.1 tron # .fi
101 1.1 tron # This document assumes that header and body_checks rules are specified
102 1.1 tron # in the form of Postfix regular expression lookup tables. Usually the
103 1.1 tron # best performance is obtained with \fBpcre\fR (Perl Compatible Regular
104 1.1.1.4 tron # Expression) tables. The \fBregexp\fR (POSIX regular
105 1.1.1.4 tron # expressions) tables are usually slower, but more widely
106 1.1.1.4 tron # available.
107 1.1 tron # Use the command "\fBpostconf -m\fR" to find out what lookup table
108 1.1 tron # types your Postfix system supports.
109 1.1 tron #
110 1.1 tron # The general format of Postfix regular expression tables is
111 1.1 tron # given below.
112 1.1 tron # For a discussion of specific pattern or flags syntax,
113 1.1 tron # see \fBpcre_table\fR(5) or \fBregexp_table\fR(5), respectively.
114 1.1 tron # .IP "\fB/\fIpattern\fB/\fIflags action\fR"
115 1.1 tron # When /\fIpattern\fR/ matches the input string, execute
116 1.1 tron # the corresponding \fIaction\fR. See below for a list
117 1.1 tron # of possible actions.
118 1.1 tron # .IP "\fB!/\fIpattern\fB/\fIflags action\fR"
119 1.1 tron # When /\fIpattern\fR/ does \fBnot\fR match the input string,
120 1.1 tron # execute the corresponding \fIaction\fR.
121 1.1 tron # .IP "\fBif /\fIpattern\fB/\fIflags\fR"
122 1.1 tron # .IP "\fBendif\fR"
123 1.1.1.6 christos # If the input string matches /\fIpattern\fR/, then match that
124 1.1.1.6 christos # input string against the patterns between \fBif\fR and
125 1.1.1.6 christos # \fBendif\fR. The \fBif\fR..\fBendif\fR can nest.
126 1.1 tron # .sp
127 1.1 tron # Note: do not prepend whitespace to patterns inside
128 1.1 tron # \fBif\fR..\fBendif\fR.
129 1.1 tron # .IP "\fBif !/\fIpattern\fB/\fIflags\fR"
130 1.1 tron # .IP "\fBendif\fR"
131 1.1.1.6 christos # If the input string does not match /\fIpattern\fR/, then
132 1.1.1.6 christos # match that input string against the patterns between \fBif\fR
133 1.1.1.6 christos # and \fBendif\fR. The \fBif\fR..\fBendif\fR can nest.
134 1.1 tron # .IP "blank lines and comments"
135 1.1 tron # Empty lines and whitespace-only lines are ignored, as
136 1.1 tron # are lines whose first non-whitespace character is a `#'.
137 1.1 tron # .IP "multi-line text"
138 1.1 tron # A pattern/action line starts with non-whitespace text. A line that
139 1.1 tron # starts with whitespace continues a logical line.
140 1.1 tron # TABLE SEARCH ORDER
141 1.1 tron # .ad
142 1.1 tron # .fi
143 1.1 tron # For each line of message input, the patterns are applied in the
144 1.1 tron # order as specified in the table. When a pattern is found that matches
145 1.1 tron # the input line, the corresponding action is executed and then the
146 1.1 tron # next input line is inspected.
147 1.1 tron # TEXT SUBSTITUTION
148 1.1 tron # .ad
149 1.1 tron # .fi
150 1.1 tron # Substitution of substrings from the matched expression into the
151 1.1 tron # \fIaction\fR
152 1.1 tron # string is possible using the conventional Perl syntax
153 1.1 tron # (\fB$1\fR, \fB$2\fR, etc.).
154 1.1 tron # The macros in the result string may need to be written as \fB${n}\fR
155 1.1 tron # or \fB$(n)\fR if they aren't followed by whitespace.
156 1.1 tron #
157 1.1 tron # Note: since negated patterns (those preceded by \fB!\fR) return a
158 1.1 tron # result when the expression does not match, substitutions are not
159 1.1 tron # available for negated patterns.
160 1.1 tron # ACTIONS
161 1.1 tron # .ad
162 1.1 tron # .fi
163 1.1 tron # Action names are case insensitive. They are shown in upper case
164 1.1 tron # for consistency with other Postfix documentation.
165 1.1.1.6 christos # .IP "\fBBCC \fIuser@domain\fR"
166 1.1.1.6 christos # Add the specified address as a BCC recipient, and inspect
167 1.1.1.6 christos # the next input line. The address
168 1.1.1.6 christos # must have a local part and domain part. The number of BCC
169 1.1.1.6 christos # addresses that can be added is limited only by the amount
170 1.1.1.6 christos # of available storage space.
171 1.1.1.6 christos #
172 1.1.1.6 christos # Note 1: the BCC address is added as if it was specified with
173 1.1.1.6 christos # NOTIFY=NONE. The sender will not be notified when the BCC
174 1.1.1.6 christos # address is undeliverable, as long as all down-stream software
175 1.1.1.6 christos # implements RFC 3461.
176 1.1.1.6 christos #
177 1.1.1.6 christos # Note 2: this ignores duplicate addresses (with the same
178 1.1.1.6 christos # delivery status notification options).
179 1.1.1.6 christos # .sp
180 1.1.1.6 christos # This feature is available in Postfix 3.0 and later.
181 1.1.1.6 christos # .sp
182 1.1.1.6 christos # This feature is not supported with smtp header/body checks.
183 1.1 tron # \" .IP "\fBDELAY \fItime\fR"
184 1.1 tron # \" Place the message into the deferred queue, and delay the
185 1.1 tron # \" initial delivery attempt by \fItime\fR. The time value may
186 1.1 tron # \" be followed by a one-character suffix that specifies the
187 1.1 tron # \" time unit: s (seconds), m (minutes), h (hours), d (days),
188 1.1 tron # \" w (weeks). The default time unit is s (seconds).
189 1.1 tron # \" .sp
190 1.1 tron # \" Limitations:
191 1.1 tron # \" .RS
192 1.1 tron # \" .IP \(bu
193 1.1 tron # \" This action affects all the recipients of the message.
194 1.1 tron # \" .IP \(bu
195 1.1 tron # \" The delay value has no effect with remote file systems that
196 1.1 tron # \" don't correctly emulate UNIX local file system semantics.
197 1.1 tron # \" In that case, the delay will be half of $queue_run_delay
198 1.1 tron # \" on average.
199 1.1 tron # \" .IP \(bu
200 1.1 tron # \" Mail will still be delivered with "sendmail -q", "postfix
201 1.1 tron # \" flush" or "postqueue -f".
202 1.1 tron # \" .IP \(bu
203 1.1 tron # \" Delayed mail increases the amount of disk I/O during deferred
204 1.1 tron # \" queue scans. When large amounts of mail are queued for
205 1.1 tron # \" delayed delivery it may be preferable to use the HOLD feature
206 1.1 tron # \" instead.
207 1.1 tron # \" .RE
208 1.1 tron # \" .IP
209 1.1 tron # \" This feature is available in Postfix 2.3 and later.
210 1.1 tron # .IP "\fBDISCARD \fIoptional text...\fR"
211 1.1 tron # Claim successful delivery and silently discard the message.
212 1.1.1.6 christos # Do not inspect the remainder of the input message.
213 1.1 tron # Log the optional text if specified, otherwise log a generic
214 1.1 tron # message.
215 1.1 tron # .sp
216 1.1 tron # Note: this action disables further header or body_checks inspection
217 1.1 tron # of the current message and affects all recipients.
218 1.1 tron # To discard only one recipient without discarding the entire message,
219 1.1 tron # use the transport(5) table to direct mail to the discard(8) service.
220 1.1 tron # .sp
221 1.1 tron # This feature is available in Postfix 2.0 and later.
222 1.1.1.3 tron # .sp
223 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
224 1.1 tron # .IP \fBDUNNO\fR
225 1.1 tron # Pretend that the input line did not match any pattern, and inspect the
226 1.1 tron # next input line. This action can be used to shorten the table search.
227 1.1 tron # .sp
228 1.1 tron # For backwards compatibility reasons, Postfix also accepts
229 1.1 tron # \fBOK\fR but it is (and always has been) treated as \fBDUNNO\fR.
230 1.1 tron # .sp
231 1.1 tron # This feature is available in Postfix 2.1 and later.
232 1.1 tron # .IP "\fBFILTER \fItransport:destination\fR"
233 1.1.1.6 christos # Override the content_filter parameter setting, and inspect
234 1.1.1.6 christos # the next input line.
235 1.1.1.2 tron # After the message is queued, send the entire message through
236 1.1.1.2 tron # the specified external content filter. The \fItransport\fR
237 1.1.1.2 tron # name specifies the first field of a mail delivery agent
238 1.1.1.2 tron # definition in master.cf; the syntax of the next-hop
239 1.1.1.2 tron # \fIdestination\fR is described in the manual page of the
240 1.1.1.2 tron # corresponding delivery agent. More information about
241 1.1.1.2 tron # external content filters is in the Postfix FILTER_README
242 1.1.1.2 tron # file.
243 1.1.1.2 tron # .sp
244 1.1.1.2 tron # Note 1: do not use $\fInumber\fR regular expression
245 1.1.1.2 tron # substitutions for \fItransport\fR or \fIdestination\fR
246 1.1.1.2 tron # unless you know that the information has a trusted origin.
247 1.1.1.2 tron # .sp
248 1.1.1.2 tron # Note 2: this action overrides the main.cf \fBcontent_filter\fR
249 1.1.1.2 tron # setting, and affects all recipients of the message. In the
250 1.1.1.2 tron # case that multiple \fBFILTER\fR actions fire, only the last
251 1.1.1.2 tron # one is executed.
252 1.1.1.2 tron # .sp
253 1.1.1.2 tron # Note 3: the purpose of the FILTER command is to override
254 1.1.1.2 tron # message routing. To override the recipient's \fItransport\fR
255 1.1.1.2 tron # but not the next-hop \fIdestination\fR, specify an empty
256 1.1.1.2 tron # filter \fIdestination\fR (Postfix 2.7 and later), or specify
257 1.1.1.2 tron # a \fItransport:destination\fR that delivers through a
258 1.1.1.2 tron # different Postfix instance (Postfix 2.6 and earlier). Other
259 1.1.1.2 tron # options are using the recipient-dependent \fBtrans\%port\%_maps\fR
260 1.1.1.2 tron # or the sen\%der-dependent
261 1.1.1.2 tron # \fBsender\%_de\%pen\%dent\%_de\%fault\%_trans\%port\%_maps\fR
262 1.1.1.2 tron # features.
263 1.1 tron # .sp
264 1.1 tron # This feature is available in Postfix 2.0 and later.
265 1.1.1.3 tron # .sp
266 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
267 1.1 tron # .IP "\fBHOLD \fIoptional text...\fR"
268 1.1 tron # Arrange for the message to be placed on the \fBhold\fR queue,
269 1.1 tron # and inspect the next input line. The message remains on \fBhold\fR
270 1.1 tron # until someone either deletes it or releases it for delivery.
271 1.1 tron # Log the optional text if specified, otherwise log a generic
272 1.1 tron # message.
273 1.1 tron #
274 1.1 tron # Mail that is placed on hold can be examined with the
275 1.1 tron # \fBpostcat\fR(1) command, and can be destroyed or released with
276 1.1 tron # the \fBpostsuper\fR(1) command.
277 1.1 tron # .sp
278 1.1 tron # Note: use "\fBpostsuper -r\fR" to release mail that was kept on
279 1.1 tron # hold for a significant fraction of \fB$maximal_queue_lifetime\fR
280 1.1 tron # or \fB$bounce_queue_lifetime\fR, or longer. Use "\fBpostsuper -H\fR"
281 1.1 tron # only for mail that will not expire within a few delivery attempts.
282 1.1 tron # .sp
283 1.1 tron # Note: this action affects all recipients of the message.
284 1.1 tron # .sp
285 1.1 tron # This feature is available in Postfix 2.0 and later.
286 1.1.1.3 tron # .sp
287 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
288 1.1 tron # .IP \fBIGNORE\fR
289 1.1 tron # Delete the current line from the input, and inspect
290 1.1 tron # the next input line.
291 1.1.1.3 tron # .IP "\fBINFO \fIoptional text...\fR
292 1.1.1.3 tron # Log an "info:" record with the \fIoptional text...\fR (or
293 1.1.1.3 tron # log a generic text), and inspect the next input line. This
294 1.1.1.3 tron # action is useful for routine logging or for debugging.
295 1.1.1.3 tron # .sp
296 1.1.1.3 tron # This feature is available in Postfix 2.8 and later.
297 1.1 tron # .IP "\fBPREPEND \fItext...\fR"
298 1.1 tron # Prepend one line with the specified text, and inspect the next
299 1.1 tron # input line.
300 1.1 tron # .sp
301 1.1 tron # Notes:
302 1.1 tron # .RS
303 1.1 tron # .IP \(bu
304 1.1 tron # The prepended text is output on a separate line, immediately
305 1.1 tron # before the input that triggered the \fBPREPEND\fR action.
306 1.1 tron # .IP \(bu
307 1.1 tron # The prepended text is not considered part of the input
308 1.1 tron # stream: it is not subject to header/body checks or address
309 1.1 tron # rewriting, and it does not affect the way that Postfix adds
310 1.1 tron # missing message headers.
311 1.1 tron # .IP \(bu
312 1.1 tron # When prepending text before a message header line, the prepended
313 1.1 tron # text must begin with a valid message header label.
314 1.1 tron # .IP \(bu
315 1.1 tron # This action cannot be used to prepend multi-line text.
316 1.1 tron # .RE
317 1.1 tron # .IP
318 1.1 tron # This feature is available in Postfix 2.1 and later.
319 1.1.1.3 tron # .sp
320 1.1.1.3 tron # This feature is not supported with milter_header_checks.
321 1.1 tron # .IP "\fBREDIRECT \fIuser@domain\fR"
322 1.1 tron # Write a message redirection request to the queue file, and
323 1.1 tron # inspect the next input line. After the message is queued,
324 1.1 tron # it will be sent to the specified address instead of the
325 1.1 tron # intended recipient(s).
326 1.1 tron # .sp
327 1.1 tron # Note: this action overrides the \fBFILTER\fR action, and affects
328 1.1 tron # all recipients of the message. If multiple \fBREDIRECT\fR actions
329 1.1 tron # fire, only the last one is executed.
330 1.1 tron # .sp
331 1.1 tron # This feature is available in Postfix 2.1 and later.
332 1.1.1.3 tron # .sp
333 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
334 1.1 tron # .IP "\fBREPLACE \fItext...\fR"
335 1.1 tron # Replace the current line with the specified text, and inspect the next
336 1.1 tron # input line.
337 1.1 tron # .sp
338 1.1 tron # This feature is available in Postfix 2.2 and later. The
339 1.1 tron # description below applies to Postfix 2.2.2 and later.
340 1.1 tron # .sp
341 1.1 tron # Notes:
342 1.1 tron # .RS
343 1.1 tron # .IP \(bu
344 1.1 tron # When replacing a message header line, the replacement text
345 1.1 tron # must begin with a valid header label.
346 1.1 tron # .IP \(bu
347 1.1 tron # The replaced text remains part of the input stream. Unlike
348 1.1 tron # the result from the \fBPREPEND\fR action, a replaced message
349 1.1 tron # header may be subject to address rewriting and may affect
350 1.1 tron # the way that Postfix adds missing message headers.
351 1.1 tron # .RE
352 1.1 tron # .IP "\fBREJECT \fIoptional text...\fR
353 1.1.1.6 christos # Reject the entire message. Do not inspect the remainder of
354 1.1.1.6 christos # the input message. Reply with \fIoptional text...\fR when
355 1.1.1.6 christos # the optional text is specified, otherwise reply with a
356 1.1.1.6 christos # generic error message.
357 1.1 tron # .sp
358 1.1 tron # Note: this action disables further header or body_checks inspection
359 1.1 tron # of the current message and affects all recipients.
360 1.1 tron # .sp
361 1.1 tron # Postfix version 2.3 and later support enhanced status codes.
362 1.1 tron # When no code is specified at the beginning of \fIoptional
363 1.1 tron # text...\fR, Postfix inserts a default enhanced status code of
364 1.1 tron # "5.7.1".
365 1.1.1.3 tron # .sp
366 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
367 1.1 tron # .IP "\fBWARN \fIoptional text...\fR
368 1.1.1.3 tron # Log a "warning:" record with the \fIoptional text...\fR (or
369 1.1.1.3 tron # log a generic text), and inspect the next input line. This
370 1.1 tron # action is useful for debugging and for testing a pattern
371 1.1 tron # before applying more drastic actions.
372 1.1 tron # BUGS
373 1.1 tron # Empty lines never match, because some map types mis-behave
374 1.1 tron # when given a zero-length search string. This limitation may
375 1.1 tron # be removed for regular expression tables in a future release.
376 1.1 tron #
377 1.1 tron # Many people overlook the main limitations of header and body_checks
378 1.1 tron # rules.
379 1.1 tron # .IP \(bu
380 1.1 tron # These rules operate on one logical message header or one body
381 1.1 tron # line at a time. A decision made for one line is not carried over
382 1.1 tron # to the next line.
383 1.1 tron # .IP \(bu
384 1.1 tron # If text in the message body is encoded
385 1.1 tron # (RFC 2045) then the rules need to be specified for the encoded
386 1.1 tron # form.
387 1.1 tron # .IP \(bu
388 1.1 tron # Likewise, when message headers are encoded (RFC
389 1.1 tron # 2047) then the rules need to be specified for the encoded
390 1.1 tron # form.
391 1.1 tron # .PP
392 1.1 tron # Message headers added by the \fBcleanup\fR(8) daemon itself
393 1.1 tron # are excluded from inspection. Examples of such message headers
394 1.1 tron # are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR.
395 1.1 tron #
396 1.1 tron # Message headers deleted by the \fBcleanup\fR(8) daemon will
397 1.1.1.5 tron # be examined before they are deleted. Examples are: \fBBcc:\fR,
398 1.1 tron # \fBContent-Length:\fR, \fBReturn-Path:\fR.
399 1.1 tron # CONFIGURATION PARAMETERS
400 1.1 tron # .ad
401 1.1 tron # .fi
402 1.1 tron # .IP \fBbody_checks\fR
403 1.1 tron # Lookup tables with content filter rules for message body lines.
404 1.1 tron # These filters see one physical line at a time, in chunks of
405 1.1 tron # at most \fB$line_length_limit\fR bytes.
406 1.1 tron # .IP \fBbody_checks_size_limit\fP
407 1.1 tron # The amount of content per message body segment (attachment) that is
408 1.1 tron # subjected to \fB$body_checks\fR filtering.
409 1.1 tron # .IP \fBheader_checks\fR
410 1.1 tron # .IP "\fBmime_header_checks\fR (default: \fB$header_checks\fR)"
411 1.1 tron # .IP "\fBnested_header_checks\fR (default: \fB$header_checks\fR)"
412 1.1 tron # Lookup tables with content filter rules for message header lines:
413 1.1 tron # respectively, these are applied to the initial message headers
414 1.1 tron # (not including MIME headers), to the MIME headers anywhere in
415 1.1 tron # the message, and to the initial headers of attached messages.
416 1.1 tron # .sp
417 1.1 tron # Note: these filters see one logical message header at a time, even
418 1.1 tron # when a message header spans multiple lines. Message headers that
419 1.1 tron # are longer than \fB$header_size_limit\fR characters are truncated.
420 1.1 tron # .IP \fBdisable_mime_input_processing\fR
421 1.1 tron # While receiving mail, give no special treatment to MIME related
422 1.1 tron # message headers; all text after the initial message headers is
423 1.1 tron # considered to be part of the message body. This means that
424 1.1 tron # \fBheader_checks\fR is applied to all the initial message headers,
425 1.1 tron # and that \fBbody_checks\fR is applied to the remainder of the
426 1.1 tron # message.
427 1.1 tron # .sp
428 1.1 tron # Note: when used in this manner, \fBbody_checks\fR will process
429 1.1 tron # a multi-line message header one line at a time.
430 1.1 tron # EXAMPLES
431 1.1 tron # .ad
432 1.1 tron # .fi
433 1.1 tron # Header pattern to block attachments with bad file name
434 1.1 tron # extensions. For convenience, the PCRE /x flag is specified,
435 1.1 tron # so that there is no need to collapse the pattern into a
436 1.1 tron # single line of text. The purpose of the [[:xdigit:]]
437 1.1 tron # sub-expressions is to recognize Windows CLSID strings.
438 1.1 tron #
439 1.1 tron # .na
440 1.1 tron # .nf
441 1.1 tron # /etc/postfix/main.cf:
442 1.1 tron # header_checks = pcre:/etc/postfix/header_checks.pcre
443 1.1 tron #
444 1.1 tron # /etc/postfix/header_checks.pcre:
445 1.1.1.6 christos # /^Content-(Disposition|Type).*name\es*=\es*"?([^;]*(\e.|=2E)(
446 1.1 tron # ade|adp|asp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|
447 1.1 tron # hlp|ht[at]|
448 1.1 tron # inf|ins|isp|jse?|lnk|md[betw]|ms[cipt]|nws|
449 1.1 tron # \e{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\e}|
450 1.1 tron # ops|pcd|pif|prf|reg|sc[frt]|sh[bsm]|swf|
451 1.1 tron # vb[esx]?|vxd|ws[cfh]))(\e?=)?"?\es*(;|$)/x
452 1.1 tron # REJECT Attachment name "$2" may not end with ".$4"
453 1.1 tron # .ad
454 1.1 tron # .fi
455 1.1 tron #
456 1.1 tron # Body pattern to stop a specific HTML browser vulnerability exploit.
457 1.1 tron #
458 1.1 tron # .na
459 1.1 tron # .nf
460 1.1 tron # /etc/postfix/main.cf:
461 1.1 tron # body_checks = regexp:/etc/postfix/body_checks
462 1.1 tron #
463 1.1 tron # /etc/postfix/body_checks:
464 1.1 tron # /^<iframe src=(3D)?cid:.* height=(3D)?0 width=(3D)?0>$/
465 1.1 tron # REJECT IFRAME vulnerability exploit
466 1.1 tron # SEE ALSO
467 1.1 tron # cleanup(8), canonicalize and enqueue Postfix message
468 1.1 tron # pcre_table(5), format of PCRE lookup tables
469 1.1 tron # regexp_table(5), format of POSIX regular expression tables
470 1.1 tron # postconf(1), Postfix configuration utility
471 1.1 tron # postmap(1), Postfix lookup table management
472 1.1 tron # postsuper(1), Postfix janitor
473 1.1 tron # postcat(1), show Postfix queue file contents
474 1.1 tron # RFC 2045, base64 and quoted-printable encoding rules
475 1.1 tron # RFC 2047, message header encoding for non-ASCII text
476 1.1 tron # README FILES
477 1.1 tron # .ad
478 1.1 tron # .fi
479 1.1 tron # Use "\fBpostconf readme_directory\fR" or
480 1.1 tron # "\fBpostconf html_directory\fR" to locate this information.
481 1.1 tron # .na
482 1.1 tron # .nf
483 1.1 tron # DATABASE_README, Postfix lookup table overview
484 1.1 tron # CONTENT_INSPECTION_README, Postfix content inspection overview
485 1.1 tron # BUILTIN_FILTER_README, Postfix built-in content inspection
486 1.1 tron # BACKSCATTER_README, blocking returned forged mail
487 1.1 tron # LICENSE
488 1.1 tron # .ad
489 1.1 tron # .fi
490 1.1 tron # The Secure Mailer license must be distributed with this software.
491 1.1 tron # AUTHOR(S)
492 1.1 tron # Wietse Venema
493 1.1 tron # IBM T.J. Watson Research
494 1.1 tron # P.O. Box 704
495 1.1 tron # Yorktown Heights, NY 10598, USA
496 1.1.1.6 christos #
497 1.1.1.6 christos # Wietse Venema
498 1.1.1.6 christos # Google, Inc.
499 1.1.1.6 christos # 111 8th Avenue
500 1.1.1.6 christos # New York, NY 10011, USA
501 1.1 tron #--
502