header_checks - Postfix built-in header/body inspection
header_checks = pcre:/etc/postfix/header_checks
mime_header_checks = pcre:/etc/postfix/mime_header_checks
nested_header_checks = pcre:/etc/postfix/nested_header_checks
body_checks = pcre:/etc/postfix/body_checks postmap -fq "string" pcre:/etc/postfix/filename
postmap -fq - pcre:/etc/postfix/filename <inputfile
For examples, see the EXAMPLES section at the end of this manual page.
Postfix header or body_checks are designed to stop a flood of mail from worms or viruses; they do not decode attachments, and they do not unzip archives. See the documents referenced below in the README FILES section if you need more sophisticated content analysis.
Postfix supports four built-in content inspection classes:
This feature is available in Postfix 2.0 and later.
This feature is available in Postfix 2.0 and later.
With Postfix versions before 2.0, all content after the initial message headers is treated as body content.
Note: message headers are examined one logical header at a time, even when a message header spans multiple lines. Body lines are always examined one line at a time.
This document assumes that header and body_checks rules are specified in the form of Postfix regular expression lookup tables. Usually the best performance is obtained with pcre (Perl Compatible Regular Expression) tables, but the slower regexp (POSIX regular expressions) support is more widely available. Use the command "postconf -m" to find out what lookup table types your Postfix system supports.
The general format of Postfix regular expression tables is given below. For a discussion of specific pattern or flags syntax, see pcre_table(5) or regexp_table(5), respectively.
Note: do not prepend whitespace to patterns inside if..endif.
For each line of message input, the patterns are applied in the order as specified in the table. When a pattern is found that matches the input line, the corresponding action is executed and then the next input line is inspected.
Substitution of substrings from the matched expression into the action string is possible using the conventional Perl syntax ($1, $2, etc.). The macros in the result string may need to be written as ${n} or $(n) if they aren't followed by whitespace.
Note: since negated patterns (those preceded by !) return a result when the expression does not match, substitutions are not available for negated patterns.
Action names are case insensitive. They are shown in upper case for consistency with other Postfix documentation.
Note: this action disables further header or body_checks inspection of the current message and affects all recipients. To discard only one recipient without discarding the entire message, use the transport(5) table to direct mail to the discard(8) service.
This feature is available in Postfix 2.0 and later.
For backwards compatibility reasons, Postfix also accepts OK but it is (and always has been) treated as DUNNO.
This feature is available in Postfix 2.1 and later.
Note: this action overrides the main.cf content_filter setting, and affects all recipients of the message. In the case that multiple FILTER actions fire, only the last one is executed.
This feature is available in Postfix 2.0 and later.
Mail that is placed on hold can be examined with the postcat(1) command, and can be destroyed or released with the postsuper(1) command.
Note: use "postsuper -r" to release mail that was kept on hold for a significant fraction of $maximal_queue_lifetime or $bounce_queue_lifetime, or longer.
Note: this action affects all recipients of the message.
This feature is available in Postfix 2.0 and later.
Notes:
Note: this action overrides the FILTER action, and affects all recipients of the message. If multiple REDIRECT actions fire, only the last one is executed.
This feature is available in Postfix 2.1 and later.
This feature is available in Postfix 2.2 and later. The description below applies to Postfix 2.2.2 and later.
Notes:
Note: this action disables further header or body_checks inspection of the current message and affects all recipients.
Postfix version 2.3 and later support enhanced status codes. When no code is specified at the beginning of optional text..., Postfix inserts a default enhanced status code of "5.7.1".
Message headers added by the cleanup(8) daemon itself are excluded from inspection. Examples of such message headers are From:, To:, Message-ID:, Date:.
Message headers deleted by the cleanup(8) daemon will be examined before they are deleted. Examples are: Bcc:, Content-Length:, Return-Path:.
Note: these filters see one logical message header at a time, even when a message header spans multiple lines. Message headers that are longer than $header_size_limit characters are truncated.
Note: when used in this manner, body_checks will process a multi-line message header one line at a time.
Header pattern to block attachments with bad file name extensions.
/etc/postfix/main.cf:Body pattern to stop a specific HTML browser vulnerability exploit.
header_checks = regexp:/etc/postfix/header_checks /etc/postfix/header_checks:
/^content-(type|disposition):.*name[[:space:]]*=.*\.(exe|vbs)/
REJECT Bad attachment file name extension: $2
/etc/postfix/main.cf:
body_checks = regexp:/etc/postfix/body_checks /etc/postfix/body_checks:
/^<iframe src=(3D)?cid:.* height=(3D)?0 width=(3D)?0>$/
REJECT IFRAME vulnerability exploit
cleanup(8), canonicalize and enqueue Postfix message pcre_table(5), format of PCRE lookup tables regexp_table(5), format of POSIX regular expression tables postconf(1), Postfix configuration utility postmap(1), Postfix lookup table management postsuper(1), Postfix janitor postcat(1), show Postfix queue file contents RFC 2045, base64 and quoted-printable encoding rules RFC 2047, message header encoding for non-ASCII text
Use "postconf readme_directory" or "postconf html_directory" to locate this information.
DATABASE_README, Postfix lookup table overview CONTENT_INSPECTION_README, Postfix content inspection overview BUILTIN_FILTER_README, Postfix built-in content inspection BACKSCATTER_README, blocking returned forged mail
The Secure Mailer license must be distributed with this software.
Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |