header_checks revision 1.1.1.5 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 tron # Match the input string against the patterns between \fBif\fR
124 1.1 tron # and \fBendif\fR, if and only if the same input string also
125 1.1 tron # matches /\fIpattern\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 tron # Match the input string against the patterns between \fBif\fR
132 1.1 tron # and \fBendif\fR, if and only if the same input string does
133 1.1 tron # \fBnot\fR match /\fIpattern\fR/. The \fBif\fR..\fBendif\fR
134 1.1 tron # can nest.
135 1.1 tron # .IP "blank lines and comments"
136 1.1 tron # Empty lines and whitespace-only lines are ignored, as
137 1.1 tron # are lines whose first non-whitespace character is a `#'.
138 1.1 tron # .IP "multi-line text"
139 1.1 tron # A pattern/action line starts with non-whitespace text. A line that
140 1.1 tron # starts with whitespace continues a logical line.
141 1.1 tron # TABLE SEARCH ORDER
142 1.1 tron # .ad
143 1.1 tron # .fi
144 1.1 tron # For each line of message input, the patterns are applied in the
145 1.1 tron # order as specified in the table. When a pattern is found that matches
146 1.1 tron # the input line, the corresponding action is executed and then the
147 1.1 tron # next input line is inspected.
148 1.1 tron # TEXT SUBSTITUTION
149 1.1 tron # .ad
150 1.1 tron # .fi
151 1.1 tron # Substitution of substrings from the matched expression into the
152 1.1 tron # \fIaction\fR
153 1.1 tron # string is possible using the conventional Perl syntax
154 1.1 tron # (\fB$1\fR, \fB$2\fR, etc.).
155 1.1 tron # The macros in the result string may need to be written as \fB${n}\fR
156 1.1 tron # or \fB$(n)\fR if they aren't followed by whitespace.
157 1.1 tron #
158 1.1 tron # Note: since negated patterns (those preceded by \fB!\fR) return a
159 1.1 tron # result when the expression does not match, substitutions are not
160 1.1 tron # available for negated patterns.
161 1.1 tron # ACTIONS
162 1.1 tron # .ad
163 1.1 tron # .fi
164 1.1 tron # Action names are case insensitive. They are shown in upper case
165 1.1 tron # for consistency with other Postfix documentation.
166 1.1 tron # \" .IP "\fBDELAY \fItime\fR"
167 1.1 tron # \" Place the message into the deferred queue, and delay the
168 1.1 tron # \" initial delivery attempt by \fItime\fR. The time value may
169 1.1 tron # \" be followed by a one-character suffix that specifies the
170 1.1 tron # \" time unit: s (seconds), m (minutes), h (hours), d (days),
171 1.1 tron # \" w (weeks). The default time unit is s (seconds).
172 1.1 tron # \" .sp
173 1.1 tron # \" Limitations:
174 1.1 tron # \" .RS
175 1.1 tron # \" .IP \(bu
176 1.1 tron # \" This action affects all the recipients of the message.
177 1.1 tron # \" .IP \(bu
178 1.1 tron # \" The delay value has no effect with remote file systems that
179 1.1 tron # \" don't correctly emulate UNIX local file system semantics.
180 1.1 tron # \" In that case, the delay will be half of $queue_run_delay
181 1.1 tron # \" on average.
182 1.1 tron # \" .IP \(bu
183 1.1 tron # \" Mail will still be delivered with "sendmail -q", "postfix
184 1.1 tron # \" flush" or "postqueue -f".
185 1.1 tron # \" .IP \(bu
186 1.1 tron # \" Delayed mail increases the amount of disk I/O during deferred
187 1.1 tron # \" queue scans. When large amounts of mail are queued for
188 1.1 tron # \" delayed delivery it may be preferable to use the HOLD feature
189 1.1 tron # \" instead.
190 1.1 tron # \" .RE
191 1.1 tron # \" .IP
192 1.1 tron # \" This feature is available in Postfix 2.3 and later.
193 1.1 tron # .IP "\fBDISCARD \fIoptional text...\fR"
194 1.1 tron # Claim successful delivery and silently discard the message.
195 1.1 tron # Log the optional text if specified, otherwise log a generic
196 1.1 tron # message.
197 1.1 tron # .sp
198 1.1 tron # Note: this action disables further header or body_checks inspection
199 1.1 tron # of the current message and affects all recipients.
200 1.1 tron # To discard only one recipient without discarding the entire message,
201 1.1 tron # use the transport(5) table to direct mail to the discard(8) service.
202 1.1 tron # .sp
203 1.1 tron # This feature is available in Postfix 2.0 and later.
204 1.1.1.3 tron # .sp
205 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
206 1.1 tron # .IP \fBDUNNO\fR
207 1.1 tron # Pretend that the input line did not match any pattern, and inspect the
208 1.1 tron # next input line. This action can be used to shorten the table search.
209 1.1 tron # .sp
210 1.1 tron # For backwards compatibility reasons, Postfix also accepts
211 1.1 tron # \fBOK\fR but it is (and always has been) treated as \fBDUNNO\fR.
212 1.1 tron # .sp
213 1.1 tron # This feature is available in Postfix 2.1 and later.
214 1.1 tron # .IP "\fBFILTER \fItransport:destination\fR"
215 1.1.1.2 tron # After the message is queued, send the entire message through
216 1.1.1.2 tron # the specified external content filter. The \fItransport\fR
217 1.1.1.2 tron # name specifies the first field of a mail delivery agent
218 1.1.1.2 tron # definition in master.cf; the syntax of the next-hop
219 1.1.1.2 tron # \fIdestination\fR is described in the manual page of the
220 1.1.1.2 tron # corresponding delivery agent. More information about
221 1.1.1.2 tron # external content filters is in the Postfix FILTER_README
222 1.1.1.2 tron # file.
223 1.1.1.2 tron # .sp
224 1.1.1.2 tron # Note 1: do not use $\fInumber\fR regular expression
225 1.1.1.2 tron # substitutions for \fItransport\fR or \fIdestination\fR
226 1.1.1.2 tron # unless you know that the information has a trusted origin.
227 1.1.1.2 tron # .sp
228 1.1.1.2 tron # Note 2: this action overrides the main.cf \fBcontent_filter\fR
229 1.1.1.2 tron # setting, and affects all recipients of the message. In the
230 1.1.1.2 tron # case that multiple \fBFILTER\fR actions fire, only the last
231 1.1.1.2 tron # one is executed.
232 1.1.1.2 tron # .sp
233 1.1.1.2 tron # Note 3: the purpose of the FILTER command is to override
234 1.1.1.2 tron # message routing. To override the recipient's \fItransport\fR
235 1.1.1.2 tron # but not the next-hop \fIdestination\fR, specify an empty
236 1.1.1.2 tron # filter \fIdestination\fR (Postfix 2.7 and later), or specify
237 1.1.1.2 tron # a \fItransport:destination\fR that delivers through a
238 1.1.1.2 tron # different Postfix instance (Postfix 2.6 and earlier). Other
239 1.1.1.2 tron # options are using the recipient-dependent \fBtrans\%port\%_maps\fR
240 1.1.1.2 tron # or the sen\%der-dependent
241 1.1.1.2 tron # \fBsender\%_de\%pen\%dent\%_de\%fault\%_trans\%port\%_maps\fR
242 1.1.1.2 tron # features.
243 1.1 tron # .sp
244 1.1 tron # This feature is available in Postfix 2.0 and later.
245 1.1.1.3 tron # .sp
246 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
247 1.1 tron # .IP "\fBHOLD \fIoptional text...\fR"
248 1.1 tron # Arrange for the message to be placed on the \fBhold\fR queue,
249 1.1 tron # and inspect the next input line. The message remains on \fBhold\fR
250 1.1 tron # until someone either deletes it or releases it for delivery.
251 1.1 tron # Log the optional text if specified, otherwise log a generic
252 1.1 tron # message.
253 1.1 tron #
254 1.1 tron # Mail that is placed on hold can be examined with the
255 1.1 tron # \fBpostcat\fR(1) command, and can be destroyed or released with
256 1.1 tron # the \fBpostsuper\fR(1) command.
257 1.1 tron # .sp
258 1.1 tron # Note: use "\fBpostsuper -r\fR" to release mail that was kept on
259 1.1 tron # hold for a significant fraction of \fB$maximal_queue_lifetime\fR
260 1.1 tron # or \fB$bounce_queue_lifetime\fR, or longer. Use "\fBpostsuper -H\fR"
261 1.1 tron # only for mail that will not expire within a few delivery attempts.
262 1.1 tron # .sp
263 1.1 tron # Note: this action affects all recipients of the message.
264 1.1 tron # .sp
265 1.1 tron # This feature is available in Postfix 2.0 and later.
266 1.1.1.3 tron # .sp
267 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
268 1.1 tron # .IP \fBIGNORE\fR
269 1.1 tron # Delete the current line from the input, and inspect
270 1.1 tron # the next input line.
271 1.1.1.3 tron # .IP "\fBINFO \fIoptional text...\fR
272 1.1.1.3 tron # Log an "info:" record with the \fIoptional text...\fR (or
273 1.1.1.3 tron # log a generic text), and inspect the next input line. This
274 1.1.1.3 tron # action is useful for routine logging or for debugging.
275 1.1.1.3 tron # .sp
276 1.1.1.3 tron # This feature is available in Postfix 2.8 and later.
277 1.1 tron # .IP "\fBPREPEND \fItext...\fR"
278 1.1 tron # Prepend one line with the specified text, and inspect the next
279 1.1 tron # input line.
280 1.1 tron # .sp
281 1.1 tron # Notes:
282 1.1 tron # .RS
283 1.1 tron # .IP \(bu
284 1.1 tron # The prepended text is output on a separate line, immediately
285 1.1 tron # before the input that triggered the \fBPREPEND\fR action.
286 1.1 tron # .IP \(bu
287 1.1 tron # The prepended text is not considered part of the input
288 1.1 tron # stream: it is not subject to header/body checks or address
289 1.1 tron # rewriting, and it does not affect the way that Postfix adds
290 1.1 tron # missing message headers.
291 1.1 tron # .IP \(bu
292 1.1 tron # When prepending text before a message header line, the prepended
293 1.1 tron # text must begin with a valid message header label.
294 1.1 tron # .IP \(bu
295 1.1 tron # This action cannot be used to prepend multi-line text.
296 1.1 tron # .RE
297 1.1 tron # .IP
298 1.1 tron # This feature is available in Postfix 2.1 and later.
299 1.1.1.3 tron # .sp
300 1.1.1.3 tron # This feature is not supported with milter_header_checks.
301 1.1 tron # .IP "\fBREDIRECT \fIuser@domain\fR"
302 1.1 tron # Write a message redirection request to the queue file, and
303 1.1 tron # inspect the next input line. After the message is queued,
304 1.1 tron # it will be sent to the specified address instead of the
305 1.1 tron # intended recipient(s).
306 1.1 tron # .sp
307 1.1 tron # Note: this action overrides the \fBFILTER\fR action, and affects
308 1.1 tron # all recipients of the message. If multiple \fBREDIRECT\fR actions
309 1.1 tron # fire, only the last one is executed.
310 1.1 tron # .sp
311 1.1 tron # This feature is available in Postfix 2.1 and later.
312 1.1.1.3 tron # .sp
313 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
314 1.1 tron # .IP "\fBREPLACE \fItext...\fR"
315 1.1 tron # Replace the current line with the specified text, and inspect the next
316 1.1 tron # input line.
317 1.1 tron # .sp
318 1.1 tron # This feature is available in Postfix 2.2 and later. The
319 1.1 tron # description below applies to Postfix 2.2.2 and later.
320 1.1 tron # .sp
321 1.1 tron # Notes:
322 1.1 tron # .RS
323 1.1 tron # .IP \(bu
324 1.1 tron # When replacing a message header line, the replacement text
325 1.1 tron # must begin with a valid header label.
326 1.1 tron # .IP \(bu
327 1.1 tron # The replaced text remains part of the input stream. Unlike
328 1.1 tron # the result from the \fBPREPEND\fR action, a replaced message
329 1.1 tron # header may be subject to address rewriting and may affect
330 1.1 tron # the way that Postfix adds missing message headers.
331 1.1 tron # .RE
332 1.1 tron # .IP "\fBREJECT \fIoptional text...\fR
333 1.1 tron # Reject the entire message. Reply with \fIoptional text...\fR when
334 1.1 tron # the optional text is specified, otherwise reply with a generic error
335 1.1 tron # message.
336 1.1 tron # .sp
337 1.1 tron # Note: this action disables further header or body_checks inspection
338 1.1 tron # of the current message and affects all recipients.
339 1.1 tron # .sp
340 1.1 tron # Postfix version 2.3 and later support enhanced status codes.
341 1.1 tron # When no code is specified at the beginning of \fIoptional
342 1.1 tron # text...\fR, Postfix inserts a default enhanced status code of
343 1.1 tron # "5.7.1".
344 1.1.1.3 tron # .sp
345 1.1.1.3 tron # This feature is not supported with smtp header/body checks.
346 1.1 tron # .IP "\fBWARN \fIoptional text...\fR
347 1.1.1.3 tron # Log a "warning:" record with the \fIoptional text...\fR (or
348 1.1.1.3 tron # log a generic text), and inspect the next input line. This
349 1.1 tron # action is useful for debugging and for testing a pattern
350 1.1 tron # before applying more drastic actions.
351 1.1 tron # BUGS
352 1.1 tron # Empty lines never match, because some map types mis-behave
353 1.1 tron # when given a zero-length search string. This limitation may
354 1.1 tron # be removed for regular expression tables in a future release.
355 1.1 tron #
356 1.1 tron # Many people overlook the main limitations of header and body_checks
357 1.1 tron # rules.
358 1.1 tron # .IP \(bu
359 1.1 tron # These rules operate on one logical message header or one body
360 1.1 tron # line at a time. A decision made for one line is not carried over
361 1.1 tron # to the next line.
362 1.1 tron # .IP \(bu
363 1.1 tron # If text in the message body is encoded
364 1.1 tron # (RFC 2045) then the rules need to be specified for the encoded
365 1.1 tron # form.
366 1.1 tron # .IP \(bu
367 1.1 tron # Likewise, when message headers are encoded (RFC
368 1.1 tron # 2047) then the rules need to be specified for the encoded
369 1.1 tron # form.
370 1.1 tron # .PP
371 1.1 tron # Message headers added by the \fBcleanup\fR(8) daemon itself
372 1.1 tron # are excluded from inspection. Examples of such message headers
373 1.1 tron # are \fBFrom:\fR, \fBTo:\fR, \fBMessage-ID:\fR, \fBDate:\fR.
374 1.1 tron #
375 1.1 tron # Message headers deleted by the \fBcleanup\fR(8) daemon will
376 1.1.1.5 tron # be examined before they are deleted. Examples are: \fBBcc:\fR,
377 1.1 tron # \fBContent-Length:\fR, \fBReturn-Path:\fR.
378 1.1 tron # CONFIGURATION PARAMETERS
379 1.1 tron # .ad
380 1.1 tron # .fi
381 1.1 tron # .IP \fBbody_checks\fR
382 1.1 tron # Lookup tables with content filter rules for message body lines.
383 1.1 tron # These filters see one physical line at a time, in chunks of
384 1.1 tron # at most \fB$line_length_limit\fR bytes.
385 1.1 tron # .IP \fBbody_checks_size_limit\fP
386 1.1 tron # The amount of content per message body segment (attachment) that is
387 1.1 tron # subjected to \fB$body_checks\fR filtering.
388 1.1 tron # .IP \fBheader_checks\fR
389 1.1 tron # .IP "\fBmime_header_checks\fR (default: \fB$header_checks\fR)"
390 1.1 tron # .IP "\fBnested_header_checks\fR (default: \fB$header_checks\fR)"
391 1.1 tron # Lookup tables with content filter rules for message header lines:
392 1.1 tron # respectively, these are applied to the initial message headers
393 1.1 tron # (not including MIME headers), to the MIME headers anywhere in
394 1.1 tron # the message, and to the initial headers of attached messages.
395 1.1 tron # .sp
396 1.1 tron # Note: these filters see one logical message header at a time, even
397 1.1 tron # when a message header spans multiple lines. Message headers that
398 1.1 tron # are longer than \fB$header_size_limit\fR characters are truncated.
399 1.1 tron # .IP \fBdisable_mime_input_processing\fR
400 1.1 tron # While receiving mail, give no special treatment to MIME related
401 1.1 tron # message headers; all text after the initial message headers is
402 1.1 tron # considered to be part of the message body. This means that
403 1.1 tron # \fBheader_checks\fR is applied to all the initial message headers,
404 1.1 tron # and that \fBbody_checks\fR is applied to the remainder of the
405 1.1 tron # message.
406 1.1 tron # .sp
407 1.1 tron # Note: when used in this manner, \fBbody_checks\fR will process
408 1.1 tron # a multi-line message header one line at a time.
409 1.1 tron # EXAMPLES
410 1.1 tron # .ad
411 1.1 tron # .fi
412 1.1 tron # Header pattern to block attachments with bad file name
413 1.1 tron # extensions. For convenience, the PCRE /x flag is specified,
414 1.1 tron # so that there is no need to collapse the pattern into a
415 1.1 tron # single line of text. The purpose of the [[:xdigit:]]
416 1.1 tron # sub-expressions is to recognize Windows CLSID strings.
417 1.1 tron #
418 1.1 tron # .na
419 1.1 tron # .nf
420 1.1 tron # /etc/postfix/main.cf:
421 1.1 tron # header_checks = pcre:/etc/postfix/header_checks.pcre
422 1.1 tron #
423 1.1 tron # /etc/postfix/header_checks.pcre:
424 1.1 tron # /^Content-(Disposition|Type).*name\es*=\es*"?(.*(\e.|=2E)(
425 1.1 tron # ade|adp|asp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|
426 1.1 tron # hlp|ht[at]|
427 1.1 tron # inf|ins|isp|jse?|lnk|md[betw]|ms[cipt]|nws|
428 1.1 tron # \e{[[:xdigit:]]{8}(?:-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}\e}|
429 1.1 tron # ops|pcd|pif|prf|reg|sc[frt]|sh[bsm]|swf|
430 1.1 tron # vb[esx]?|vxd|ws[cfh]))(\e?=)?"?\es*(;|$)/x
431 1.1 tron # REJECT Attachment name "$2" may not end with ".$4"
432 1.1 tron # .ad
433 1.1 tron # .fi
434 1.1 tron #
435 1.1 tron # Body pattern to stop a specific HTML browser vulnerability exploit.
436 1.1 tron #
437 1.1 tron # .na
438 1.1 tron # .nf
439 1.1 tron # /etc/postfix/main.cf:
440 1.1 tron # body_checks = regexp:/etc/postfix/body_checks
441 1.1 tron #
442 1.1 tron # /etc/postfix/body_checks:
443 1.1 tron # /^<iframe src=(3D)?cid:.* height=(3D)?0 width=(3D)?0>$/
444 1.1 tron # REJECT IFRAME vulnerability exploit
445 1.1 tron # SEE ALSO
446 1.1 tron # cleanup(8), canonicalize and enqueue Postfix message
447 1.1 tron # pcre_table(5), format of PCRE lookup tables
448 1.1 tron # regexp_table(5), format of POSIX regular expression tables
449 1.1 tron # postconf(1), Postfix configuration utility
450 1.1 tron # postmap(1), Postfix lookup table management
451 1.1 tron # postsuper(1), Postfix janitor
452 1.1 tron # postcat(1), show Postfix queue file contents
453 1.1 tron # RFC 2045, base64 and quoted-printable encoding rules
454 1.1 tron # RFC 2047, message header encoding for non-ASCII text
455 1.1 tron # README FILES
456 1.1 tron # .ad
457 1.1 tron # .fi
458 1.1 tron # Use "\fBpostconf readme_directory\fR" or
459 1.1 tron # "\fBpostconf html_directory\fR" to locate this information.
460 1.1 tron # .na
461 1.1 tron # .nf
462 1.1 tron # DATABASE_README, Postfix lookup table overview
463 1.1 tron # CONTENT_INSPECTION_README, Postfix content inspection overview
464 1.1 tron # BUILTIN_FILTER_README, Postfix built-in content inspection
465 1.1 tron # BACKSCATTER_README, blocking returned forged mail
466 1.1 tron # LICENSE
467 1.1 tron # .ad
468 1.1 tron # .fi
469 1.1 tron # The Secure Mailer license must be distributed with this software.
470 1.1 tron # AUTHOR(S)
471 1.1 tron # Wietse Venema
472 1.1 tron # IBM T.J. Watson Research
473 1.1 tron # P.O. Box 704
474 1.1 tron # Yorktown Heights, NY 10598, USA
475 1.1 tron #--
476