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