Home | History | Annotate | Line # | Download | only in html
PCRE_README.html revision 1.1.1.3
      1      1.1      tron <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
      2      1.1      tron         "http://www.w3.org/TR/html4/loose.dtd">
      3      1.1      tron 
      4      1.1      tron <html>
      5      1.1      tron 
      6      1.1      tron <head>
      7      1.1      tron 
      8      1.1      tron <title>Postfix PCRE Support</title>
      9      1.1      tron 
     10  1.1.1.3  christos <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     11      1.1      tron 
     12      1.1      tron </head>
     13      1.1      tron 
     14      1.1      tron <body>
     15      1.1      tron 
     16      1.1      tron <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix PCRE Support</h1>
     17      1.1      tron 
     18      1.1      tron <hr>
     19      1.1      tron 
     20      1.1      tron <h2>PCRE (Perl Compatible Regular Expressions) map support</h2>
     21      1.1      tron 
     22      1.1      tron <p> The optional "pcre" map type allows you to specify regular
     23      1.1      tron expressions with the PERL style notation such as \s for space and
     24      1.1      tron \S for non-space. The main benefit, however, is that pcre lookups
     25      1.1      tron are often faster than regexp lookups. This is because the pcre
     26      1.1      tron implementation is often more efficient than the POSIX regular
     27      1.1      tron expression implementation that you find on many systems. </p>
     28      1.1      tron 
     29      1.1      tron <p> A description of how to use pcre tables, including examples,
     30      1.1      tron is given in the <a href="pcre_table.5.html">pcre_table(5)</a> manual page. Information about PCRE
     31      1.1      tron itself can be found at <a href="http://www.pcre.org/">http://www.pcre.org/</a>. </p>
     32      1.1      tron 
     33  1.1.1.3  christos <h2>Using Postfix packages with PCRE support</h2>
     34      1.1      tron 
     35  1.1.1.3  christos <p> To use pcre with Debian GNU/Linux's Postfix, or with Fedora or
     36  1.1.1.3  christos RHEL Postfix, all you
     37      1.1      tron need is to install the postfix-pcre package and you're done.  There
     38      1.1      tron is no need to recompile Postfix. </p>
     39      1.1      tron 
     40  1.1.1.3  christos <h2>Building Postfix from source with PCRE support</h2>
     41      1.1      tron 
     42  1.1.1.3  christos <p> These instructions assume that you build Postfix from source
     43  1.1.1.3  christos code as described in the <a href="INSTALL.html">INSTALL</a> document. </p>
     44      1.1      tron 
     45  1.1.1.3  christos <p> To build Postfix from source with pcre support, you need a pcre
     46  1.1.1.3  christos library. Install a vendor package, or download the source code from
     47  1.1.1.3  christos locations in <a href="https://www.pcre.org/">https://www.pcre.org/</a> and build that yourself.
     48  1.1.1.3  christos 
     49  1.1.1.3  christos <p> Postfix can build with the pcre2 library or the legacy pcre
     50  1.1.1.3  christos library. It's probably easiest to let the Postfix build procedure
     51  1.1.1.3  christos pick one. The following commands will first discover if the pcre2
     52  1.1.1.3  christos library is installed, and if that is not available, will discover
     53  1.1.1.3  christos if the legacy pcre library is installed. </p>
     54  1.1.1.3  christos 
     55  1.1.1.3  christos <blockquote>
     56  1.1.1.3  christos <pre>
     57  1.1.1.3  christos $ make -f Makefile.init makefiles 
     58  1.1.1.3  christos $ make
     59  1.1.1.3  christos </pre>
     60      1.1      tron </blockquote>
     61      1.1      tron 
     62  1.1.1.3  christos <p> To build Postfix explicitly with a pcre2 library (Postfix 3.7
     63  1.1.1.3  christos and later): </p>
     64  1.1.1.3  christos 
     65  1.1.1.3  christos <blockquote>
     66  1.1.1.3  christos <pre>
     67  1.1.1.3  christos $ make -f Makefile.init makefiles \
     68  1.1.1.3  christos     "CCARGS=-DHAS_PCRE=2 `pcre2-config --cflags`" \
     69  1.1.1.3  christos     "<a href="PCRE_README.html">AUXLIBS_PCRE</a>=`pcre2-config --libs8`"
     70  1.1.1.3  christos $ make
     71  1.1.1.3  christos </pre>
     72  1.1.1.3  christos </blockquote>
     73      1.1      tron 
     74  1.1.1.3  christos <p> To build Postfix explicitly with a legacy pcre library (all
     75  1.1.1.3  christos Postfix versions): </p>
     76      1.1      tron 
     77      1.1      tron <blockquote>
     78      1.1      tron <pre>
     79  1.1.1.3  christos $ make -f Makefile.init makefiles \
     80  1.1.1.3  christos     "CCARGS=-DHAS_PCRE=1 `pcre-config --cflags`" \
     81  1.1.1.2  christos     "<a href="PCRE_README.html">AUXLIBS_PCRE</a>=`pcre-config --libs`"
     82  1.1.1.3  christos $ make
     83      1.1      tron </pre>
     84      1.1      tron </blockquote>
     85      1.1      tron 
     86  1.1.1.2  christos <p> Postfix versions before 3.0 use AUXLIBS instead of <a href="PCRE_README.html">AUXLIBS_PCRE</a>.
     87  1.1.1.2  christos With Postfix 3.0 and later, the old AUXLIBS variable still supports
     88  1.1.1.2  christos building a statically-loaded PCRE database client, but only the new
     89  1.1.1.2  christos <a href="PCRE_README.html">AUXLIBS_PCRE</a> variable supports building a dynamically-loaded or 
     90  1.1.1.2  christos statically-loaded PCRE database client.  </p>
     91      1.1      tron 
     92      1.1      tron <blockquote>
     93  1.1.1.2  christos  
     94  1.1.1.2  christos <p> Failure to use the <a href="PCRE_README.html">AUXLIBS_PCRE</a> variable will defeat the purpose
     95  1.1.1.2  christos of dynamic database client loading. Every Postfix executable file
     96  1.1.1.2  christos will have PCRE library dependencies. And that was exactly
     97  1.1.1.2  christos what dynamic database client loading was meant to avoid. </p>
     98  1.1.1.2  christos  
     99      1.1      tron </blockquote>
    100      1.1      tron 
    101      1.1      tron <h2>Things to know</h2>
    102      1.1      tron 
    103      1.1      tron <ul>
    104      1.1      tron 
    105      1.1      tron <li> <p> When Postfix searches a <a href="pcre_table.5.html">pcre</a>: or <a href="regexp_table.5.html">regexp</a>: lookup table,
    106      1.1      tron each pattern is applied to the entire input string. Depending on
    107      1.1      tron the application, that string is an entire client hostname, an entire
    108      1.1      tron client IP address, or an entire mail address. Thus, no parent domain
    109      1.1      tron or parent network search is done, "user@domain" mail addresses are
    110      1.1      tron not broken up into their user and domain constituent parts, and
    111      1.1      tron "user+foo" is not broken up into user and foo.  </p>
    112      1.1      tron 
    113      1.1      tron <li> <p> Regular expression tables such as <a href="pcre_table.5.html">pcre</a>: or <a href="regexp_table.5.html">regexp</a>: are
    114      1.1      tron not allowed to do $number substitution in lookup results that can
    115      1.1      tron be security sensitive: currently, that restriction applies to the
    116      1.1      tron local <a href="aliases.5.html">aliases(5)</a> database or the <a href="virtual.8.html">virtual(8)</a> delivery agent tables.
    117      1.1      tron </p>
    118      1.1      tron 
    119      1.1      tron </ul>
    120      1.1      tron 
    121      1.1      tron </body>
    122      1.1      tron 
    123      1.1      tron </html>
    124