home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / postfix / header_checks < prev    next >
Text File  |  2006-05-02  |  16KB  |  380 lines

  1. # HEADER_CHECKS(5)                                              HEADER_CHECKS(5)
  2. # NAME
  3. #        header_checks - Postfix built-in header/body inspection
  4. # SYNOPSIS
  5. #        header_checks = pcre:/etc/postfix/header_checks
  6. #        mime_header_checks = pcre:/etc/postfix/mime_header_checks
  7. #        nested_header_checks = pcre:/etc/postfix/nested_header_checks
  8. #        body_checks = pcre:/etc/postfix/body_checks
  9. #        postmap -fq "string" pcre:/etc/postfix/filename
  10. #        postmap -fq - pcre:/etc/postfix/filename <inputfile
  11. # DESCRIPTION
  12. #        Postfix  provides  a  simple  built-in  content inspection
  13. #        mechanism that examines incoming mail one  message  header
  14. #        or one message body line at a time. Each input is compared
  15. #        against a list of patterns, and when a match is found  the
  16. #        corresponding  action is executed.  This feature is imple-
  17. #        mented by the Postfix cleanup(8) server.
  18. #        For examples, see the EXAMPLES section at the end of  this
  19. #        manual page.
  20. #        Postfix header or body_checks are designed to stop a flood
  21. #        of mail from worms or viruses; they do not decode  attach-
  22. #        ments,  and  they do not unzip archives. See the documents
  23. #        referenced below in the README FILES section if  you  need
  24. #        more sophisticated content analysis.
  25. #        Postfix supports four built-in content inspection classes:
  26. #        header_checks
  27. #               These  are  applied  to  initial  message   headers
  28. #               (except  for  the  headers  that are processed with
  29. #               mime_header_checks).
  30. #        mime_header_checks (default: $header_checks)
  31. #               These are applied to MIME related  message  headers
  32. #               only.
  33. #               This feature is available in Postfix 2.0 and later.
  34. #        nested_header_checks (default: $header_checks)
  35. #               These are applied to message  headers  of  attached
  36. #               email  messages  (except  for  the headers that are
  37. #               processed with mime_header_checks).
  38. #               This feature is available in Postfix 2.0 and later.
  39. #        body_checks
  40. #               These  are  applied to all other content, including
  41. #               multi-part message boundaries.
  42. #               With Postfix versions before 2.0, all content after
  43. #               the initial message headers is treated as body con-
  44. #               tent.
  45. #        Note: message headers are examined one logical header at a
  46. #        time,  even  when  a  message header spans multiple lines.
  47. #        Body lines are always examined one line at a time.
  48. # TABLE FORMAT
  49. #        This document assumes that header  and  body_checks  rules
  50. #        are  specified  in  the form of Postfix regular expression
  51. #        lookup tables. Usually the best  performance  is  obtained
  52. #        with pcre (Perl Compatible Regular Expression) tables, but
  53. #        the slower regexp (POSIX regular expressions)  support  is
  54. #        more  widely  available.  Use the command "postconf -m" to
  55. #        find out what lookup table types your Postfix system  sup-
  56. #        ports.
  57. #        The general format of Postfix regular expression tables is
  58. #        given below.  For a  discussion  of  specific  pattern  or
  59. #        flags   syntax,   see  pcre_table(5)  or  regexp_table(5),
  60. #        respectively.
  61. #        /pattern/flags action
  62. #               When pattern matches the input string, execute  the
  63. #               corresponding  action. See below for a list of pos-
  64. #               sible actions.
  65. #        !/pattern/flags action
  66. #               When pattern does not match the input string,  exe-
  67. #               cute the corresponding action.
  68. #        if /pattern/flags
  69. #        endif  Match the input string against the patterns between
  70. #               if and endif, if and only if the input string  also
  71. #               matches pattern. The if..endif can nest.
  72. #               Note:  do not prepend whitespace to patterns inside
  73. #               if..endif.
  74. #        if !/pattern/flags
  75. #        endif  Match the input string against the patterns between
  76. #               if  and endif, if and only if the input string does
  77. #               not match pattern. The if..endif can nest.
  78. #        blank lines and comments
  79. #               Empty lines and whitespace-only lines are  ignored,
  80. #               as  are  lines whose first non-whitespace character
  81. #               is a `#'.
  82. #        multi-line text
  83. #               A pattern/action line  starts  with  non-whitespace
  84. #               text.  A line that starts with whitespace continues
  85. #               a logical line.
  86. # TABLE SEARCH ORDER
  87. #        For each line of message input, the patterns  are  applied
  88. #        in  the order as specified in the table. When a pattern is
  89. #        found that  matches  the  input  line,  the  corresponding
  90. #        action  is  executed  and  then  the  next  input  line is
  91. #        inspected.
  92. # TEXT SUBSTITUTION
  93. #        Substitution of substrings  from  the  matched  expression
  94. #        into  the action string is possible using the conventional
  95. #        Perl syntax ($1, $2, etc.).   The  macros  in  the  result
  96. #        string  may  need  to  be  written as ${n} or $(n) if they
  97. #        aren't followed by whitespace.
  98. #        Note: since negated patterns (those preceded by !)  return
  99. #        a result when the expression does not match, substitutions
  100. #        are not available for negated patterns.
  101. # ACTIONS
  102. #        Action names are case insensitive. They are shown in upper
  103. #        case for consistency with other Postfix documentation.
  104. #        DISCARD optional text...
  105. #               Claim  successful delivery and silently discard the
  106. #               message.  Log the optional text if specified,  oth-
  107. #               erwise log a generic message.
  108. #               Note:   this  action  disables  further  header  or
  109. #               body_checks inspection of the current  message  and
  110. #               affects all recipients.
  111. #               This feature is available in Postfix 2.0 and later.
  112. #        DUNNO  Pretend that the input line did not match any  pat-
  113. #               tern,  and inspect the next input line. This action
  114. #               can be used to shorten the table search.
  115. #               For backwards compatibility reasons,  Postfix  also
  116. #               accepts  OK but it is (and always has been) treated
  117. #               as DUNNO.
  118. #               This feature is available in Postfix 2.1 and later.
  119. #        FILTER transport:destination
  120. #               Write  a  content  filter request to the queue file
  121. #               and inspect the next input line.   After  the  com-
  122. #               plete  message  is received it will be sent through
  123. #               the specified external content filter.  More infor-
  124. #               mation  about  external  content  filters is in the
  125. #               Postfix FILTER_README file.
  126. #               Note:  this  action  overrides  the  main.cf   con-
  127. #               tent_filter  setting, and affects all recipients of
  128. #               the message.  In  the  case  that  multiple  FILTER
  129. #               actions fire, only the last one is executed.
  130. #               This feature is available in Postfix 2.0 and later.
  131. #        HOLD optional text...
  132. #               Arrange for the message to be placed  on  the  hold
  133. #               queue,  and  inspect the next input line.  The mes-
  134. #               sage remains on hold until someone  either  deletes
  135. #               it  or  releases it for delivery.  Log the optional
  136. #               text if specified, otherwise log a generic message.
  137. #               Mail  that  is  placed on hold can be examined with
  138. #               the postcat(1) command, and  can  be  destroyed  or
  139. #               released with the postsuper(1) command.
  140. #               Note:  use  "postsuper -r" to release mail that was
  141. #               kept on hold for a significant fraction  of  $maxi-
  142. #               mal_queue_lifetime  or  $bounce_queue_lifetime,  or
  143. #               longer.
  144. #               Note: this action affects  all  recipients  of  the
  145. #               message.
  146. #               This feature is available in Postfix 2.0 and later.
  147. #        IGNORE Delete the current line from the input and  inspect
  148. #               the next input line.
  149. #        PREPEND text...
  150. #               Prepend  one  line  with  the  specified  text  and
  151. #               inspect the next input line.
  152. #               Notes:
  153. #               o      The prepended text is output on  a  separate
  154. #                      line,  immediately  before  the  input  that
  155. #                      triggered the PREPEND action.
  156. #               o      The prepended text is not considered part of
  157. #                      the  input  stream:  it  is  not  subject to
  158. #                      header/body checks or address rewriting, and
  159. #                      it does not affect the way that Postfix adds
  160. #                      missing message headers.
  161. #               o      When prepending text before a message header
  162. #                      line,  the  prepended text must begin with a
  163. #                      valid message header label.
  164. #               o      This action cannot be used to prepend multi-
  165. #                      line text.
  166. #               This feature is available in Postfix 2.1 and later.
  167. #        REDIRECT user@domain
  168. #               Write a message redirection request  to  the  queue
  169. #               file  and  inspect  the  next input line. After the
  170. #               message is queued, it will be sent to the specified
  171. #               address instead of the intended recipient(s).
  172. #               Note:  this action overrides the FILTER action, and
  173. #               affects all recipients of the message. If  multiple
  174. #               REDIRECT  actions  fire,  only the last one is exe-
  175. #               cuted.
  176. #               This feature is available in Postfix 2.1 and later.
  177. #        REPLACE text...
  178. #               Replace  the  current  line with the specified text
  179. #               and inspect the next input line.
  180. #               This feature is available in Postfix 2.2 and later.
  181. #               The  description below applies to Postfix 2.2.2 and
  182. #               later.
  183. #               Notes:
  184. #               o      When replacing a message  header  line,  the
  185. #                      replacement  text  must  begin  with a valid
  186. #                      header label.
  187. #               o      The replaced text remains part of the  input
  188. #                      stream.  Unlike  the result from the PREPEND
  189. #                      action, a replaced  message  header  may  be
  190. #                      subject  to address rewriting and may affect
  191. #                      the way that Postfix  adds  missing  message
  192. #                      headers.
  193. #        REJECT optional text...
  194. #               Reject  the  entire  message.  Reply  with optional
  195. #               text... when the optional text is specified, other-
  196. #               wise reply with a generic error message.
  197. #               Note:   this  action  disables  further  header  or
  198. #               body_checks inspection of the current  message  and
  199. #               affects all recipients.
  200. #        WARN optional text...
  201. #               Log  a  warning with the optional text... (or log a
  202. #               generic message) and inspect the next  input  line.
  203. #               This action is useful for debugging and for testing
  204. #               a pattern before applying more drastic actions.
  205. # BUGS
  206. #        Many people overlook the main limitations  of  header  and
  207. #        body_checks  rules.   These  rules  operate on one logical
  208. #        message header or one body line at a time, and a  decision
  209. #        made  for  one  line is not carried over to the next line.
  210. #        If text in the message body is encoded (RFC 2045) then the
  211. #        rules  have  to specified for the encoded form.  Likewise,
  212. #        when message headers are encoded (RFC 2047) then the rules
  213. #        need to be specified for the encoded form.
  214. #        Message  headers added by the cleanup(8) daemon itself are
  215. #        excluded from inspection. Examples of such message headers
  216. #        are From:, To:, Message-ID:, Date:.
  217. #        Message  headers  deleted by the cleanup(8) daemon will be
  218. #        examined before they are deleted. Examples are: Bcc:, Con-
  219. #        tent-Length:, Return-Path:.
  220. # CONFIGURATION PARAMETERS
  221. #        body_checks
  222. #               Lookup tables with content filter rules for message
  223. #               body lines.  These filters see one physical line at
  224. #               a  time,  in  chunks  of at most $line_length_limit
  225. #               bytes.
  226. #        body_checks_size_limit
  227. #               The amount of  content  per  message  body  segment
  228. #               (attachment) that is subjected to $body_checks fil-
  229. #               tering.
  230. #        header_checks
  231. #        mime_header_checks (default: $header_checks)
  232. #        nested_header_checks (default: $header_checks)
  233. #               Lookup tables with content filter rules for message
  234. #               header  lines:  respectively,  these are applied to
  235. #               the initial message  headers  (not  including  MIME
  236. #               headers),  to the MIME headers anywhere in the mes-
  237. #               sage, and to the initial headers of  attached  mes-
  238. #               sages.
  239. #               Note:  these filters see one logical message header
  240. #               at a time, even when a message header spans  multi-
  241. #               ple  lines.  Message  headers  that are longer than
  242. #               $header_size_limit characters are truncated.
  243. #        disable_mime_input_processing
  244. #               While receiving mail, give no special treatment  to
  245. #               MIME  related  message  headers; all text after the
  246. #               initial message headers is considered to be part of
  247. #               the  message body. This means that header_checks is
  248. #               applied to all the  initial  message  headers,  and
  249. #               that body_checks is applied to the remainder of the
  250. #               message.
  251. #               Note: when used in this  manner,  body_checks  will
  252. #               process  a  multi-line message header one line at a
  253. #               time.
  254. # EXAMPLES
  255. #        Header pattern to block attachments  with  bad  file  name
  256. #        extensions.
  257. #        /etc/postfix/main.cf:
  258. #            header_checks = regexp:/etc/postfix/header_checks
  259. #        /etc/postfix/header_checks:
  260. #            /^content-(type|disposition):.*name[[:space:]]*=.*\.(exe|vbs)/
  261. #                REJECT Bad attachment file name extension: $2
  262. #        Body pattern to stop a specific HTML browser vulnerability
  263. #        exploit.
  264. #        /etc/postfix/main.cf:
  265. #            body_checks = regexp:/etc/postfix/body_checks
  266. #        /etc/postfix/body_checks:
  267. #            /^<iframe src=(3D)?cid:.* height=(3D)?0 width=(3D)?0>$/
  268. #                REJECT IFRAME vulnerability exploit
  269. # SEE ALSO
  270. #        cleanup(8), canonicalize and enqueue Postfix message
  271. #        pcre_table(5), format of PCRE lookup tables
  272. #        regexp_table(5), format of POSIX regular expression tables
  273. #        postconf(1), Postfix configuration utility
  274. #        postmap(1), Postfix lookup table management
  275. #        postsuper(1), Postfix janitor
  276. #        postcat(1), show Postfix queue file contents
  277. #        RFC 2045, base64 and quoted-printable encoding rules
  278. #        RFC 2047, message header encoding for non-ASCII text
  279. # README FILES
  280. #        Use "postconf readme_directory" or  "postconf  html_direc-
  281. #        tory" to locate this information.
  282. #        DATABASE_README, Postfix lookup table overview
  283. #        CONTENT_INSPECTION_README, Postfix content inspection overview
  284. #        BUILTIN_FILTER_README, Postfix built-in content inspection
  285. #        BACKSCATTER_README, blocking returned forged mail
  286. # LICENSE
  287. #        The  Secure  Mailer  license must be distributed with this
  288. #        software.
  289. # AUTHOR(S)
  290. #        Wietse Venema
  291. #        IBM T.J. Watson Research
  292. #        P.O. Box 704
  293. #        Yorktown Heights, NY 10598, USA
  294. #                                                               HEADER_CHECKS(5)
  295.