Home | History | Annotate | Line # | Download | only in html
      1 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
      2         "https://www.w3.org/TR/html4/loose.dtd">
      3 
      4 <html>
      5 
      6 <head>
      7 
      8 <title>Postfix Installation From Source Code </title>
      9 
     10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     11 <link rel='stylesheet' type='text/css' href='postfix-doc.css'>
     12 
     13 </head>
     14 
     15 <body>
     16 
     17 <h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix
     18 Installation From Source Code </h1>
     19 
     20 <hr>
     21 
     22 <h2> <a name="1">1 - Purpose of this document</a> </h2>
     23 
     24 <p> If you are using a pre-compiled version of Postfix, you should
     25 start with <a href="BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README</a> and the general documentation
     26 referenced by it.  <a href="INSTALL.html">INSTALL</a> is only a bootstrap document to get
     27 Postfix up and running from scratch with the minimal number of
     28 steps; it should not be considered part of the general documentation.
     29 </p>
     30 
     31 <p> This document describes how to build, install and configure a
     32 Postfix system so that it can do one of the following: </p>
     33 
     34 <ul>
     35 
     36 <li> Send mail only, without changing an existing Sendmail
     37 installation.
     38 
     39 <li> Send and receive mail via a virtual host interface, still
     40 without any change to an existing Sendmail installation.
     41 
     42 <li> Run Postfix instead of Sendmail.
     43 
     44 </ul>
     45 
     46 <p> Topics covered in this document: </p>
     47 
     48 <ol>
     49 
     50 <li> <a href="#1">Purpose of this document</a>
     51 
     52 <li> <a href="#2">Typographical conventions</a>
     53 
     54 <li> <a href="#3">Documentation</a>
     55 
     56 <li> <a href="#4">Building on a supported system</a>
     57 
     58 <li> <a href="#5">Porting Postfix to an unsupported system</a>
     59 
     60 <li> <a href="#install">Installing the software after successful
     61 compilation </a>
     62 
     63 <li> <a href="#send_only">Configuring Postfix to send mail
     64 only </a>
     65 
     66 <li> <a href="#send_receive">Configuring Postfix to send and
     67 receive mail via virtual interface </a>
     68 
     69 <li> <a href="#replace">Running Postfix instead of Sendmail</a>
     70 
     71 <li> <a href="#mandatory">Mandatory configuration file edits</a>
     72 
     73 <li> <a href="#hamlet">To chroot or not to chroot</a>
     74 
     75 <li> <a href="#care">Care and feeding of the Postfix system</a>
     76 
     77 </ol>
     78 
     79 <h2> <a name="2">2 - Typographical conventions</a> </h2>
     80 
     81 <p> In the instructions below, a command written as </p>
     82 
     83 <blockquote>
     84 <pre>
     85 # command
     86 </pre>
     87 </blockquote>
     88 
     89 <p> should be executed as the superuser. </p>
     90 
     91 <p> A command written as </p>
     92 
     93 <blockquote>
     94 <pre>
     95 $ command
     96 </pre>
     97 </blockquote>
     98 
     99 <p> should be executed as an unprivileged user.  </p>
    100 
    101 <h2> <a name="3">3 - Documentation</a> </h2>
    102 
    103 <p> Documentation is available as README files (start with the file
    104 README_FILES/AAAREADME), as HTML web pages (point your browser to
    105 "html/index.html") and as UNIX-style manual pages. </p>
    106 
    107 <p> You should view the README files with a pager such as more(1)
    108 or less(1), because the files use backspace characters in order to
    109 produce <b>bold</b> font. To print a README file without backspace
    110 characters, use the col(1) command.  For example: </p>
    111 
    112 <blockquote>
    113 <pre>
    114 $ col -bx &lt;file | lpr
    115 </pre>
    116 </blockquote>
    117 
    118 <p> In order to view the manual pages before installing Postfix,
    119 point your MANPATH environment variable to the "man" subdirectory;
    120 be sure to use an absolute path.  </p>
    121 
    122 <blockquote>
    123 <pre>
    124 $ export MANPATH; MANPATH="`pwd`/man:$MANPATH"
    125 $ setenv MANPATH "`pwd`/man:$MANPATH"
    126 </pre>
    127 </blockquote>
    128 
    129 <p> Of particular interest is the <a href="postconf.5.html">postconf(5)</a> manual page that lists
    130 all the 900+ configuration parameters. The hyperlinks in the HTML
    131 version (html/postconf.5.html) make the text easy to navigate. </p>
    132 
    133 <p> All Postfix source files have their own built-in manual page.
    134 Tools to extract those embedded manual pages are available in the
    135 mantools directory. </p>
    136 
    137 <h2> <a name="4">4 - Building on a supported system</a> </h2>
    138 
    139 <p> Postfix development happens on FreeBSD and Linux, with occasional
    140 tests on Solaris. Support for other systems relies on feedback from
    141 their users, and may not always be up-to-date. </p>
    142 
    143 <p> OpenBSD is partially supported. The libc resolver does not
    144 implement the documented "internal resolver options which are [...]
    145 set by changing fields in the _res structure" (documented in the
    146 OpenBSD 5.6 resolver(3) manpage). This results in too many DNS
    147 queries, and false positives for queries that should fail. </p>
    148 
    149 <!--
    150 
    151 <p> At some point in time, a version of Postfix was supported on: </p>
    152 
    153 <blockquote>
    154 <p>
    155 AIX 3.2.5, 4.1.x, 4.2.0, 4.3.x, 5.2 <br>
    156 BSD/OS 2.x, 3.x, 4.x <br>
    157 FreeBSD 2.x .. 9.x <br>
    158 HP-UX  9.x, 10.x, 11.x <br>
    159 IRIX 5.x, 6.x <br>
    160 Linux Debian 1.3.1 and later <br>
    161 Linux RedHat 3.x (January 2004) and later <br>
    162 Linux Slackware 3.x and later <br>
    163 Linux SuSE 5.x and later <br>
    164 Linux Ubuntu 4.10 and later<br>
    165 Mac OS X <br>
    166 NEXTSTEP 3.x <br>
    167 NetBSD 1.x and later <br>
    168 OPENSTEP 4.x <br>
    169 OSF1.V3 - OSF1.V5 (Digital UNIX) <br>
    170 Reliant UNIX 5.x <br>
    171 SunOS 4.1.4 (March 2007) <br>
    172 SunOS 5.4 - 5.10 (Solaris 2.4..10) <br>
    173 Ultrix 4.x (well, that was long ago) <br>
    174 </p>
    175 </blockquote>
    176 
    177 <p> or something closely resemblant. </p>
    178 
    179 -->
    180 
    181 <p> Overview of topics: </p>
    182 
    183 <ul>
    184 
    185 <li><a href="#build_first">4.1 - Getting started</a> 
    186 
    187 <li><a href="#build_cc">4.2 - What compiler to use</a>
    188 
    189 <li><a href="#build_pie">4.3 - Building with Postfix position-independent
    190 executables (Postfix &ge; 3.0)</a> 
    191 
    192 <li><a href="#build_dll">4.4 - Building with Postfix dynamically-linked
    193 libraries and database plugins (Postfix &ge; 3.0)</a> 
    194 
    195 <li><a href="#build_opt">4.5 - Building with optional features</a>
    196 
    197 <li><a href="#build_over">4.6 - Overriding built-in parameter default
    198 settings</a>
    199 
    200 <li><a href="#build_other">4.7 - Overriding other compile-time
    201 features</a>
    202 
    203 <li><a href="#build_proc">4.8 - Support for thousands of processes</a>
    204 
    205 <li><a href="#build_final">4.9 - Compiling Postfix, at last</a>
    206 
    207 </ul>
    208 
    209 
    210 <h3><a name="build_first">4.1 - Getting started</a> </h3>
    211 
    212 <p> On Solaris, the "make" command and other development utilities
    213 are in /usr/ccs/bin, so you MUST have /usr/ccs/bin in your command
    214 search path. If these files do not exist, you need to install the
    215 development packages first. </p>
    216 
    217 <p> If you need to build Postfix for multiple architectures from a
    218 single source-code tree, use the "lndir" command to build a shadow
    219 tree with symbolic links to the source files. </p>
    220 
    221 <p> If at any time in the build process you get messages like: "make:
    222 don't know how to ..." you should be able to recover by running
    223 the following command from the Postfix top-level directory: </p>
    224 
    225 <blockquote>
    226 <pre>
    227 $ make -f Makefile.init makefiles
    228 </pre>
    229 </blockquote>
    230 
    231 <p> If you copied the Postfix source code after building it on another
    232 machine, it is a good idea to cd into the top-level directory and 
    233 first do this:</p>
    234 
    235 <blockquote>
    236 <pre>
    237 $ make tidy
    238 </pre>
    239 </blockquote>
    240 
    241 <p> This will get rid of any system dependencies left over from
    242 compiling the software elsewhere. </p>
    243 
    244 <h3><a name="build_cc">4.2 - What compiler to use</a></h3>
    245 
    246 <p> To build with GCC, or with the native compiler if people told me
    247 that is better for your system, just cd into the top-level Postfix
    248 directory of the source tree and type: </p>
    249 
    250 <blockquote>
    251 <pre>
    252 $ make
    253 </pre>
    254 </blockquote>
    255 
    256 <p> To build with a non-default compiler, you need to specify the name
    257 of the compiler. Here are a few examples: </p>
    258 
    259 <blockquote> 
    260 <pre>
    261 $ make makefiles CC=/opt/SUNWspro/bin/cc        (Solaris)
    262 $ make
    263 
    264 $ make makefiles CC="/opt/ansic/bin/cc -Ae"     (HP-UX)
    265 $ make
    266 
    267 $ make makefiles CC="purify cc"
    268 $ make
    269 </pre>
    270 </blockquote>
    271 
    272 <p> and so on. In some cases, optimization will be turned off
    273 automatically. </p>
    274 
    275 <h3><a name="build_pie">4.3 - Building with Postfix position-independent
    276 executables (Postfix &ge; 3.0)</a> </h3>
    277 
    278 <p> On some systems Postfix can be built with Position-Independent
    279 Executables. PIE is used by the ASLR exploit mitigation technique
    280 (ASLR = Address-Space Layout Randomization): </p>
    281 
    282 <blockquote>
    283 <pre>
    284 $ make makefiles pie=yes ...other arguments...
    285 </pre>
    286 </blockquote>
    287 
    288 <p> (Specify "make makefiles pie=no" to explicitly disable Postfix
    289 position-independent executable support). </p>
    290 
    291 <p> Postfix PIE support appears to work on Fedora Core 20, Ubuntu
    292 14.04, FreeBSD 9 and 10, and NetBSD 6 (all with the default system
    293 compilers). </p>
    294 
    295 <p> Whether the "pie=yes" above has any effect depends on the
    296 compiler.  Some compilers always produce PIE executables, and some
    297 may even complain that the Postfix build option is redundant. </p>
    298 
    299 <h3><a name="build_dll">4.4 - Building with Postfix dynamically-linked
    300 libraries and database plugins (Postfix &ge; 3.0)</a> </h3>
    301 
    302 <p> Postfix dynamically-linked library and database plugin support
    303 exists for recent versions of Linux, FreeBSD and MacOS X.
    304 Dynamically-linked library builds may become the default at some
    305 point in the future. </p>
    306 
    307 <p> Overview of topics: </p>
    308 
    309 <ul>
    310 
    311 <li><a href="#shared_enable">4.4.1 Turning on Postfix dynamically-linked
    312 library support</a>
    313 
    314 <li><a href="#dynamicmaps_enable">4.4.2 Turning on Postfix database-plugin
    315 support</a>
    316 
    317 <li><a href="#shared_custom">4.4.3 Customizing Postfix dynamically-linked
    318 libraries and database plugins</a>
    319 
    320 <li><a href="#shared_tips">4.4.4 Tips for distribution maintainers</a>
    321 
    322 </ul>
    323 
    324 <p> Note: directories with Postfix dynamically-linked  libraries
    325 or database plugins should contain only postfix-related files.
    326 Postfix dynamically-linked libraries and database plugins should
    327 not be installed in a "public" system directory such as /usr/lib
    328 or /usr/local/lib.  Linking Postfix dynamically-linked library or
    329 database-plugin files into non-Postfix programs is not supported.
    330 Postfix dynamically-linked libraries and database plugins implement
    331 a Postfix-internal API that changes without maintaining compatibility.
    332 </p>
    333 
    334 <h4><a name="shared_enable"> 4.4.1 Turning on Postfix dynamically-linked
    335 library support </a></h4>
    336 
    337 <p> Postfix can be built with Postfix dynamically-linked libraries
    338 (files typically named <tt>libpostfix-*.so</tt>). Postfix
    339 dynamically-linked libraries add minor run-time overhead and result
    340 in significantly-smaller Postfix executable files. </p>
    341 
    342 <p> Specify "shared=yes" on the "make makefiles" command line to
    343 build Postfix with dynamically-linked library support. </p>
    344 
    345 <blockquote>
    346 <pre>
    347 $ make makefiles shared=yes ...other arguments...
    348 $ make
    349 </pre>
    350 </blockquote>
    351 
    352 <p> (Specify "make makefiles shared=no" to explicitly disable Postfix
    353 dynamically-linked library support). </p>
    354 
    355 <p> This installs dynamically-linked libraries in $<a href="postconf.5.html#shlib_directory">shlib_directory</a>,
    356 typically /usr/lib/postfix or /usr/local/lib/postfix, with file
    357 names libpostfix-<i>name</i>.so, where the <i>name</i> is a source-code
    358 directory name such as "util" or "global".  </p>
    359 
    360 <p> See section 4.4.3 "<a href="#shared_custom">Customizing Postfix
    361 dynamically-linked libraries and database plugins</a>" below for
    362 how to customize the Postfix dynamically-linked library location,
    363 including support to upgrade a running mail system safely.  </p>
    364 
    365 <h4><a name="dynamicmaps_enable"> 4.4.2 Turning on Postfix
    366 database-plugin support </a></h4>
    367 
    368 <p> Additionally, Postfix can be built to support dynamic loading
    369 of Postfix database clients (database plugins) with the Debian-style
    370 dynamicmaps feature. Postfix 3.0 supports dynamic loading of <a href="CDB_README.html">cdb</a>:,
    371 <a href="ldap_table.5.html">ldap</a>:, <a href="lmdb_table.5.html">lmdb</a>:, <a href="mysql_table.5.html">mysql</a>:, <a href="pcre_table.5.html">pcre</a>:, <a href="pgsql_table.5.html">pgsql</a>:, <a href="DATABASE_README.html#types">sdbm</a>:, and <a href="sqlite_table.5.html">sqlite</a>: database
    372 clients.  Dynamic loading is useful when you distribute or install
    373 pre-compiled Postfix packages. </p>
    374 
    375 <p> Specify "dynamicmaps=yes" on the "make makefiles" command line
    376 to build Postfix with support to dynamically load Postfix database
    377 clients with the Debian-style dynamicmaps feature.
    378 </p>
    379 
    380 <blockquote>
    381 <pre>
    382 $ make makefiles dynamicmaps=yes ...other arguments...
    383 $ make
    384 </pre>
    385 </blockquote>
    386 
    387 <p> (Specify "make makefiles dynamicmaps=no" to explicitly disable
    388 Postfix database-plugin support). </p>
    389 
    390 <p> This implicitly enables dynamically-linked library support,
    391 installs the configuration file dynamicmaps.cf in $<a href="postconf.5.html#meta_directory">meta_directory</a>
    392 (usually, /etc/postfix or /usr/local/etc/postfix), and installs
    393 database plugins in $<a href="postconf.5.html#shlib_directory">shlib_directory</a> (see above).  Database plugins
    394 are named postfix-<i>type</i>.so where the <i>type</i> is a database
    395 type such as "cdb" or "ldap". </p>
    396 
    397 <blockquote>
    398 
    399 <p> NOTE: The Postfix 3.0 build procedure expects that you specify
    400 database library dependencies with variables named <a href="CDB_README.html">AUXLIBS_CDB</a>,
    401 <a href="LDAP_README.html">AUXLIBS_LDAP</a>, etc.  With Postfix 3.0 and later, the old AUXLIBS
    402 variable still supports building a statically-loaded database client,
    403 but only the new <a href="CDB_README.html">AUXLIBS_CDB</a> etc. variables support building a
    404 dynamically-loaded or statically-loaded CDB etc. database client.
    405 See <a href="CDB_README.html">CDB_README</a>, <a href="LDAP_README.html">LDAP_README</a>, etc. for details.  </p>
    406 
    407 <p> Failure to follow this advice will defeat the purpose of dynamic
    408 database client loading. Every Postfix executable file will have
    409 database library dependencies. And that was exactly what dynamic
    410 database client loading was meant to avoid. </p>
    411 
    412 </blockquote>
    413 
    414 <p> See the next section for how to customize the location and
    415 version of Postfix database plugins and the location of the file
    416 dynamicmaps.cf.  </p>
    417 
    418 <h4><a name="shared_custom"> 4.4.3 Customizing Postfix dynamically-linked
    419 libraries and database plugins </a></h4>
    420 
    421 <h5> Customizing build-time and run-time options for Postfix
    422 dynamically-linked libraries and database plugins </h5>
    423 
    424 <p> The build-time environment variables SHLIB_CFLAGS, SHLIB_RPATH,
    425 and SHLIB_SUFFIX provide control over how Postfix libraries and
    426 plugins are compiled, linked, and named.
    427 
    428 <blockquote>
    429 <pre>
    430 $ make makefiles SHLIB_CFLAGS=flags SHLIB_RPATH=rpath SHLIB_SUFFIX=suffix ...other arguments...
    431 $ make
    432 </pre>
    433 </blockquote>
    434 
    435 <p> See section 4.7 "<a href="#build_other">Overriding other
    436 compile-time features</a>" below for details. </p>
    437 
    438 <h5> Customizing the location of Postfix dynamically-linked libraries
    439 and database plugins </h5>
    440 
    441 <p> As a reminder, the directories with Postfix dynamically-linked
    442 libraries or database plugins should contain only Postfix-related
    443 files.  Linking these files into other programs is not supported.
    444 </p>
    445 
    446 <p> To override the default location of Postfix dynamically-linked
    447 libraries and database plugins specify, for example: </p>
    448 
    449 <blockquote>
    450 <pre>
    451 $ make makefiles shared=yes <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/local/lib/postfix ...
    452 </pre>
    453 </blockquote>
    454 
    455 <p> If you intend to upgrade Postfix without stopping the mail
    456 system, then you should append the Postfix release version to the
    457 <a href="postconf.5.html#shlib_directory">shlib_directory</a> pathname, to eliminate the possibility that programs
    458 will link with dynamically-linked libraries or database plugins
    459 from the wrong Postfix version.  For example: </p>
    460 
    461 <blockquote>
    462 <pre>
    463 $ make makefiles shared=yes \
    464     <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/local/lib/postfix/MAIL_VERSION ...
    465 </pre>
    466 </blockquote>
    467 
    468 <p> The command "make makefiles name=value..." will replace the
    469 string MAIL_VERSION at the end of a configuration parameter value
    470 with the Postfix release version. Do not try to specify something
    471 like $<a href="postconf.5.html#mail_version">mail_version</a> on this command line. This produces inconsistent
    472 results with different versions of the make(1) command.  </p>
    473 
    474 <p> You can change the <a href="postconf.5.html#shlib_directory">shlib_directory</a> setting after Postfix is
    475 built, with "make install" or "make upgrade". However, you may have
    476 to run ldconfig if you change <a href="postconf.5.html#shlib_directory">shlib_directory</a> after Postfix is built
    477 (the symptom is that Postfix programs fail because the run-time
    478 linker cannot find the files libpostfix-*.so).  No ldconfig command
    479 is needed if you keep the files libpostfix-*.so in the compiled-in
    480 default $<a href="postconf.5.html#shlib_directory">shlib_directory</a> location. </p>
    481 
    482 <blockquote>
    483 <pre>
    484 # make upgrade <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/local/lib/postfix ...
    485 # make install <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/local/lib/postfix ...
    486 </pre>
    487 </blockquote>
    488 
    489 <p> To append the Postfix release version to the pathname if you
    490 intend to upgrade Postfix without stopping the mail system:  </p>
    491 
    492 <blockquote>
    493 <pre>
    494 # make upgrade <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/local/lib/postfix/MAIL_VERSION ...
    495 # make install <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/local/lib/postfix/MAIL_VERSION ...
    496 </pre>
    497 </blockquote>
    498 
    499 <p> See also the comments above for appending MAIL_VERSION with
    500 the "make makefiles" command. </p>
    501 
    502 <h5> Customizing the location of dynamicmaps.cf and other files
    503 </h5>
    504 
    505 <p> The <a href="postconf.5.html#meta_directory">meta_directory</a> parameter has the same default setting as
    506 the <a href="postconf.5.html#config_directory">config_directory</a> parameter, typically /etc/postfix or
    507 /usr/local/etc/postfix. </p>
    508 
    509 <p> You can override the default <a href="postconf.5.html#meta_directory">meta_directory</a> location at compile
    510 time or after Postfix is built. To override the default location
    511 at compile time specify, for example: </p>
    512 
    513 <blockquote>
    514 <pre>
    515 % make makefiles <a href="postconf.5.html#meta_directory">meta_directory</a>=/usr/libexec/postfix ...
    516 </pre>
    517 </blockquote>
    518 
    519 <p> Here is a tip if you want to make a pathname dependent on the
    520 Postfix release version: the command "make makefiles name=value..."
    521 will replace the string MAIL_VERSION at the end of a configuration
    522 parameter value with the Postfix release version. Do not try to
    523 specify something like $<a href="postconf.5.html#mail_version">mail_version</a> on this command line. This
    524 produces inconsistent results with different versions of the make(1)
    525 command.  </p>
    526 
    527 <p> You can override the <a href="postconf.5.html#meta_directory">meta_directory</a> setting after Postfix is
    528 built, with "make install" or "make upgrade". </p>
    529 
    530 <blockquote>
    531 <pre>
    532 # make upgrade <a href="postconf.5.html#meta_directory">meta_directory</a>=/usr/libexec/postfix ...
    533 # make install <a href="postconf.5.html#meta_directory">meta_directory</a>=/usr/libexec/postfix ...
    534 </pre>
    535 </blockquote>
    536 
    537 <p> As with the command "make makefiles", the command "make
    538 install/upgrade name=value..." will replace the string MAIL_VERSION
    539 at the end of a configuration parameter value with the Postfix
    540 release version.  Do not try to specify something like $<a href="postconf.5.html#mail_version">mail_version</a>
    541 on this command line. This produces inconsistent results with
    542 different versions of the make(1) command.  </p>
    543 
    544 <h4><a name="shared_tips"> 4.4.4 Tips for distribution maintainers
    545 </a></h4>
    546 
    547 <ul>
    548 
    549 <li> <p> The <a href="postconf.5.html#shlib_directory">shlib_directory</a> parameter setting also provides the
    550 default directory for database plugin files with a relative pathname
    551 in the file dynamicmaps.cf. </p>
    552 
    553 <li> <p> The <a href="postconf.5.html#meta_directory">meta_directory</a> parameter specifies the location of the
    554 files dynamicmaps.cf, postfix-files, and some multi-instance template
    555 files. The <a href="postconf.5.html#meta_directory">meta_directory</a> parameter has the same default value as
    556 the <a href="postconf.5.html#config_directory">config_directory</a> parameter (typically, /etc/postfix or
    557 /usr/local/etc/postfix). For backwards compatibility with Postfix
    558 2.6 .. 2.11, specify "<a href="postconf.5.html#meta_directory">meta_directory</a> = $<a href="postconf.5.html#daemon_directory">daemon_directory</a>" in <a href="postconf.5.html">main.cf</a>
    559 before installing or upgrading Postfix, or specify "<a href="postconf.5.html#meta_directory">meta_directory</a>
    560 = /path/name" on the "make makefiles", "make install" or "make
    561 upgrade" command line.  </p>
    562 
    563 <li> <p> The configuration file dynamicmaps.cf will automatically
    564 include files under the directory dynamicmaps.cf.d, just like the
    565 configuration file postfix-files will automatically include files
    566 under the directory postfix-files.d.  Thanks to this, you can install
    567 or deinstall a database plugin package without having to edit
    568 postfix-files or dynamicmaps.cf. Instead, you give that plugin its
    569 own configuration files under dynamicmaps.cf.d and postfix-files.d, and
    570 you add or remove those configuration files along with the database
    571 plugin dynamically-linked object.  </p>
    572 
    573 <li> <p> Each configuration file under the directory dynamicmaps.cf.d
    574 must have the same format as the configuration file dynamicmaps.cf.
    575 There is no requirement that these configuration file *names* have a
    576 specific format.  </p>
    577 
    578 <li> <p> Each configuration file under the directory postfix-files.d
    579 must have the same format as the configuration file postfix-files.
    580 There is no requirement that these configuration file *names* have a
    581 specific format.  </p>
    582 
    583 </ul>
    584 
    585 <h3><a name="build_opt">4.5 - Building with optional features</a></h3>
    586 
    587 By default, Postfix builds as a mail system with relatively few
    588 bells and whistles. Support for third-party databases etc.
    589 must be configured when Postfix is compiled.  The following documents
    590 describe how to build Postfix with support for optional features:
    591 
    592 <blockquote>
    593 <table border="1">
    594 
    595 <tr> <th>Optional feature </th> <th>Document </th> <th>Availability</th>
    596 </tr>
    597 
    598 <tr> <td> Berkeley DB database</td> <td><a href="DB_README.html">DB_README</a></td> <td> Postfix
    599 1.0 </td> </tr>
    600 
    601 <tr> <td> CDB database</td> <td><a href="CDB_README.html">CDB_README</a></td> <td> Postfix
    602 2.2 </td> </tr>
    603 
    604 <tr> <td> LMDB database</td> <td><a href="LMDB_README.html">LMDB_README</a></td> <td> Postfix
    605 2.11 </td> </tr>
    606 
    607 <tr> <td> LDAP database</td> <td><a href="LDAP_README.html">LDAP_README</a></td> <td> Postfix
    608 1.0 </td> </tr>
    609 
    610 <tr> <td> MongoDB database</td> <td><a href="MONGODB_README.html">MONGODB_README</a></td> <td> Postfix
    611 3.9 </td> </tr>
    612 
    613 <tr> <td> MySQL database</td> <td><a href="MYSQL_README.html">MYSQL_README</a></td> <td> Postfix
    614 1.0 </td> </tr>
    615 
    616 <tr> <td> Perl compatible regular expression</td> <td><a href="PCRE_README.html">PCRE_README</a></td>
    617 <td> Postfix 1.0 </td> </tr>
    618 
    619 <tr> <td> PostgreSQL database</td> <td><a href="PGSQL_README.html">PGSQL_README</a></td> <td>
    620 Postfix 2.0 </td> </tr>
    621 
    622 <tr> <td> SASL authentication </td> <td><a href="SASL_README.html">SASL_README</a></td> <td>
    623 Postfix 1.0 </td> </tr>
    624 
    625 <tr> <td> SQLite database</td> <td><a href="SQLITE_README.html">SQLITE_README</a></td> <td> Postfix
    626 2.8 </td> </tr>
    627 
    628 <tr> <td> STARTTLS session encryption </td> <td><a href="TLS_README.html">TLS_README</a></td> <td>
    629 Postfix 2.2 </td> </tr>
    630 
    631 </table>
    632 
    633 </blockquote>
    634 
    635 <p> Note: IP version 6 support is compiled into Postfix on operating
    636 systems that have IPv6 support. See the <a href="IPV6_README.html">IPV6_README</a> file for details.
    637 </p>
    638 
    639 <h3><a name="build_over">4.6 - Overriding built-in parameter default
    640 settings</a></h3>
    641 
    642 <h4>4.6.1 - Postfix 3.0 and later </h4>
    643 
    644 <p> All Postfix configuration parameters can be changed by editing
    645 a Postfix configuration file, except for one: the parameter that
    646 specifies the location of Postfix configuration files. In order to
    647 build Postfix with a configuration directory other than /etc/postfix,
    648 use: </p>
    649 
    650 <blockquote>
    651 <pre>
    652 $ make makefiles <a href="postconf.5.html#config_directory">config_directory</a>=/some/where ...other arguments...
    653 $ make
    654 </pre>
    655 </blockquote>
    656 
    657 <p> The command "make makefiles name=value ..." will replace the
    658 string MAIL_VERSION at the end of a configuration parameter value
    659 with the Postfix release version. Do not try to specify something
    660 like $<a href="postconf.5.html#mail_version">mail_version</a> on this command line. This produces inconsistent
    661 results with different versions of the make(1) command.  </p>
    662 
    663 <p> Parameters whose defaults can be specified in this way are
    664 listed below. See the <a href="postconf.5.html">postconf(5)</a> manpage for a description
    665 (command: "<tt>nroff -man man/man5/postconf.5 | less</tt>").  </p>
    666 
    667 <blockquote>
    668 
    669 <table border="1">
    670 
    671 <tr> <th>parameter name</th>  <th>typical default</th> </tr>
    672 
    673 <tr> <td><a href="postconf.5.html#command_directory">command_directory</a></td> <td>/usr/sbin</td> </tr>
    674 
    675 <tr> <td><a href="postconf.5.html#config_directory">config_directory</a></td> <td>/etc/postfix</td> </tr>
    676 
    677 <tr> <td><a href="postconf.5.html#default_database_type">default_database_type</a></td> <td>lmdb, cdb, or hash</td> </tr>
    678 
    679 <tr> <td><a href="postconf.5.html#default_cache_db_type">default_cache_db_type</a></td> <td>lmdb or btree</td> </tr>
    680 
    681 <tr> <td><a href="postconf.5.html#daemon_directory">daemon_directory</a></td> <td>/usr/libexec/postfix</td> </tr>
    682 
    683 <tr> <td><a href="postconf.5.html#data_directory">data_directory</a></td> <td>/var/lib/postfix</td> </tr>
    684 
    685 <tr> <td><a href="postconf.5.html#html_directory">html_directory</a></td> <td>no</td> </tr>
    686 
    687 <tr> <td><a href="postconf.5.html#mail_spool_directory">mail_spool_directory</a></td> <td>/var/mail</td> </tr>
    688 
    689 <tr> <td><a href="postconf.5.html#mailq_path">mailq_path</a></td> <td>/usr/bin/mailq</td> </tr>
    690 
    691 <tr> <td><a href="postconf.5.html#manpage_directory">manpage_directory</a></td> <td>/usr/local/man</td> </tr>
    692 
    693 <tr> <td><a href="postconf.5.html#meta_directory">meta_directory</a></td> <td>/etc/postfix</td> </tr>
    694 
    695 <tr> <td><a href="postconf.5.html#newaliases_path">newaliases_path</a></td> <td>/usr/bin/newaliases</td> </tr>
    696 
    697 <tr> <td><a href="postconf.5.html#openssl_path">openssl_path</a></td> <td>openssl</td> </tr>
    698 
    699 <tr> <td><a href="postconf.5.html#queue_directory">queue_directory</a></td> <td>/var/spool/postfix</td> </tr>
    700 
    701 <tr> <td><a href="postconf.5.html#readme_directory">readme_directory</a></td> <td>no</td> </tr>
    702 
    703 <tr> <td><a href="postconf.5.html#sendmail_path">sendmail_path</a></td> <td>/usr/sbin/sendmail</td> </tr>
    704 
    705 <tr> <td><a href="postconf.5.html#shlib_directory">shlib_directory</a></td> <td>/usr/lib/postfix</td> </tr>
    706 
    707 </table>
    708 
    709 </blockquote>
    710 
    711 <h4>4.6.2 - All Postfix versions </h4>
    712 
    713 <p> All Postfix configuration parameters can be changed by editing
    714 a Postfix configuration file, except for one: the parameter that
    715 specifies the location of Postfix configuration files. In order to
    716 build Postfix with a configuration directory other than /etc/postfix,
    717 use: </p>
    718 
    719 <blockquote>
    720 <pre>
    721 $ make makefiles CCARGS="-DDEF_CONFIG_DIR=\\\"/some/where\\\""
    722 $ make
    723 </pre>
    724 </blockquote>
    725 
    726 <p> IMPORTANT: Be sure to get the quotes right. These details matter
    727 a lot. </p>
    728 
    729 <p> Parameters whose defaults can be specified in this way are
    730 listed below. See the <a href="postconf.5.html">postconf(5)</a> manpage for a description
    731 (command: "<tt>nroff -man man/man5/postconf.5 | less</tt>").  </p>
    732 
    733 <blockquote>
    734 
    735 <table border="1">
    736 
    737 <tr><th> Macro name </th> <th>default value for</th>  <th>typical
    738 default</th> </tr>
    739 
    740 <tr> <td>DEF_COMMAND_DIR</td> <td><a href="postconf.5.html#command_directory">command_directory</a></td>
    741 <td>/usr/sbin</td> </tr>
    742 
    743 <tr> <td>DEF_CONFIG_DIR</td> <td><a href="postconf.5.html#config_directory">config_directory</a></td>
    744 <td>/etc/postfix</td> </tr>
    745 
    746 <tr> <td>DEF_DB_TYPE</td> <td><a href="postconf.5.html#default_database_type">default_database_type</a></td>
    747 <td>lmdb, cdb, or hash</td> </tr>
    748 
    749 <tr> <td>DEF_CACHE_DB_TYPE</td> <td><a href="postconf.5.html#default_cache_db_type">default_cache_db_type</a></td>
    750 <td>lmdb or btree</td> </tr>
    751 
    752 <tr> <td>DEF_DAEMON_DIR</td> <td><a href="postconf.5.html#daemon_directory">daemon_directory</a></td>
    753 <td>/usr/libexec/postfix</td> </tr>
    754 
    755 <tr> <td>DEF_DATA_DIR</td> <td><a href="postconf.5.html#data_directory">data_directory</a></td>
    756 <td>/var/db/postfix</td> </tr>
    757 
    758 <tr> <td>DEF_MAILQ_PATH</td> <td><a href="postconf.5.html#mailq_path">mailq_path</a></td> <td>/usr/bin/mailq</td>
    759 </tr>
    760 
    761 <tr> <td>DEF_HTML_DIR</td> <td><a href="postconf.5.html#html_directory">html_directory</a></td>
    762 <td>no</td> </tr>
    763 
    764 <tr> <td>DEF_MANPAGE_DIR</td> <td><a href="postconf.5.html#manpage_directory">manpage_directory</a></td>
    765 <td>/usr/local/man</td> </tr>
    766 
    767 <tr> <td>DEF_NEWALIAS_PATH</td> <td><a href="postconf.5.html#newaliases_path">newaliases_path</a></td>
    768 <td>/usr/bin/newaliases</td> </tr>
    769 
    770 <tr> <td>DEF_QUEUE_DIR</td> <td><a href="postconf.5.html#queue_directory">queue_directory</a></td>
    771 <td>/var/spool/postfix</td> </tr>
    772 
    773 <tr> <td>DEF_README_DIR</td> <td><a href="postconf.5.html#readme_directory">readme_directory</a></td>
    774 <td>no</td> </tr>
    775 
    776 <tr> <td>DEF_SENDMAIL_PATH</td> <td><a href="postconf.5.html#sendmail_path">sendmail_path</a></td>
    777 <td>/usr/sbin/sendmail</td> </tr>
    778 
    779 <tr> <td>DEF_SHLIB_DIR</td> <td><a href="postconf.5.html#shlib_directory">shlib_directory</a></td>
    780 <td>/usr/lib/postfix</td> </tr>
    781 
    782 </table>
    783 
    784 </blockquote>
    785 
    786 <p> Note: the <a href="postconf.5.html#data_directory">data_directory</a> parameter (for caches and pseudo-random
    787 numbers) was introduced with Postfix version 2.5; <a href="postconf.5.html#shlib_directory">shlib_directory</a>
    788 (for shared-library objects and database plugins) with Postfix
    789 version 3.0. </p>
    790 
    791 <h3><a name="build_other">4.7 - Overriding other compile-time
    792 features</a></h3>
    793 
    794 <p> The general method to override Postfix compile-time features
    795 is as follows: </p>
    796 
    797 <blockquote>
    798 <pre>
    799 $ make makefiles name=value name=value...
    800 $ make
    801 </pre>
    802 </blockquote>
    803 
    804 <p> The following is an extensive list of names and values. </p>
    805 
    806 <table border="1">
    807 
    808 <tr> <th colspan="2"> Name/Value </th> <th> Description </th> </tr>
    809 
    810 <tr> <td colspan="2"> AUXLIBS="object_library..."</td> <td> Specifies
    811 one or more non-default object libraries. Postfix 3.0 and later
    812 specify some of their database library dependencies with <a href="CDB_README.html">AUXLIBS_CDB</a>,
    813 <a href="LDAP_README.html">AUXLIBS_LDAP</a>, <a href="LMDB_README.html">AUXLIBS_LMDB</a>, <a href="MYSQL_README.html">AUXLIBS_MYSQL</a>, <a href="PCRE_README.html">AUXLIBS_PCRE</a>, <a href="PGSQL_README.html">AUXLIBS_PGSQL</a>,
    814 AUXLIBS_SDBM, and <a href="SQLITE_README.html">AUXLIBS_SQLITE</a>, respectively. </td> </tr>
    815 
    816 <tr> <td colspan="2"> CC=compiler_command</td> <td> Specifies a
    817 non-default compiler. On many systems, the default is <tt>gcc</tt>.
    818 </td> </tr>
    819 
    820 <tr> <td colspan="2"> CCARGS="compiler_arguments..."</td> <td>
    821 Specifies non-default compiler arguments, for example, a non-default
    822 <tt>include</tt> directory.  The following directives turn
    823 off Postfix features at compile time:</td> </tr>
    824 
    825 <tr> <td> </td> <td> -DNO_DB </td> <td> Do not build with Berkeley
    826 DB support. By default, Berkeley DB support is compiled in on
    827 platforms that have historically supported this feature. If you override
    828 this, then you probably should also override <a href="postconf.5.html#default_database_type">default_database_type</a>
    829 or DEF_DB_TYPE as described in section 4.6. </td> </tr>
    830 
    831 <tr> <td> </td> <td> -DNO_DNSSEC </td> <td> Do not build with DNSSEC
    832 support, even if the resolver library appears to support it. </td>
    833 </tr>
    834 
    835 <tr> <td> </td> <td> -DNO_DEVPOLL </td> <td> Do not build with
    836 Solaris <tt>/dev/poll</tt> support. By default, <tt>/dev/poll</tt>
    837 support is compiled in on Solaris versions that are known to support
    838 this feature.  </td> </tr>
    839 
    840 <tr> <td> </td> <td> -DNO_EPOLL </td> <td> Do not build with Linux
    841 EPOLL support.  By default, EPOLL support is compiled in on platforms
    842 that are known to support this feature. </td> </tr>
    843 
    844 <tr> <td> </td> <td> -DNO_EAI </td> <td> Do not build with EAI
    845 (SMTPUTF8) support. By default, EAI support is compiled in when 
    846 the "icuuc" library and header files are found.  </td> </tr>
    847 
    848 <tr> <td> </td> <td> -DNO_INLINE </td> <td> Do not require support
    849 for C99 "inline" functions. Instead, implement argument typechecks
    850 for non-printf/scanf-like functions with ternary operators and
    851 unreachable code. </td> </tr>
    852 
    853 <tr> <td> </td> <td> -DNO_IPV6 </td> <td> Do not build with IPv6
    854 support. By default, IPv6 support is compiled in on platforms that
    855 are known to have IPv6 support. Note: this directive is for debugging
    856 and testing only. It is not guaranteed to work on all platforms.
    857 If you don't want IPv6 support, set "<a href="postconf.5.html#inet_protocols">inet_protocols</a> = ipv4" in
    858 <a href="postconf.5.html">main.cf</a>.
    859 </td> </tr>
    860 
    861 <tr> <td> </td> <td> -DNO_KQUEUE </td> <td> Do not build with FreeBSD
    862 / NetBSD / OpenBSD / MacOSX KQUEUE support. By default, KQUEUE
    863 support is compiled in on platforms that are known to support it.
    864 </td> </tr>
    865 
    866 <tr> <td> </td> <td> -DNO_NIS </td> <td> Do not build with NIS or
    867 NISPLUS support. NIS is not available on some recent Linux
    868 distributions. </td> </tr>
    869 
    870 <tr> <td> </td> <td> -DNO_NISPLUS </td> <td> Do not build with
    871 NISPLUS support. NISPLUS is not available on some recent Solaris
    872 distributions. </td> </tr>
    873 
    874 <tr> <td> </td> <td> -DNO_PCRE </td> <td> Do not build with PCRE
    875 support. By default, PCRE support is compiled in when the
    876 <tt>pcre-config</tt> utility is installed. </td> </tr>
    877 
    878 <tr> <td> </td> <td> -DNO_POSIX_GETPW_R </td> <td> Disable support
    879 for POSIX <tt>getpwnam_r/getpwuid_r</tt>. By default Postfix uses
    880 these where they are known to be available. </td> </tr>
    881 
    882 <tr> <td> </td> <td> -DNO_RES_NCALLS </td> <td> Do not build with
    883 the threadsafe resolver(5) API (res_ninit() etc.). </td> </tr>
    884 
    885 <tr> <td> </td> <td> -DNO_SIGSETJMP </td> <td> Use
    886 <tt>setjmp()/longjmp()</tt> instead of <tt>sigsetjmp()/siglongjmp()</tt>.
    887 By default, Postfix uses <tt>sigsetjmp()/siglongjmp()</tt> when
    888 they are known to be available. </td> </tr>
    889 
    890 <tr> <td> </td> <td> -DNO_SNPRINTF </td> <td> Use <tt>sprintf()</tt>
    891 instead of <tt>snprintf()</tt>.  By default, Postfix uses
    892 <tt>snprintf()</tt> except on ancient systems. </td> </tr>
    893 
    894 <tr> <td colspan="2"> DEBUG=debug_level </td> <td> Specifies a
    895 non-default compiler debugging level. The default is "<tt>-g</tt>".
    896 Specify DEBUG= to turn off debugging. </td> </tr>
    897 
    898 <tr> <td colspan="2"> OPT=optimization_level </td> <td> Specifies
    899 a non-default optimization level. The default is "<tt>-O</tt>".
    900 Specify OPT= to turn off optimization. </td> </tr>
    901 
    902 <tr> <td colspan="2"> POSTFIX_INSTALL_OPTS=-option... </td> <td>
    903 Specifies options for the <tt>postfix-install</tt> command, separated
    904 by whitespace. Currently, the only supported option is
    905 "<tt>-keep-build-mtime</tt>". </td> </tr>
    906 
    907 <tr> <td colspan="2"> SHLIB_CFLAGS=flags </td> <td> Specifies
    908 non-default compiler options for building Postfix dynamically-linked
    909 libraries and database plugins. The typical default is "-fPIC".
    910 </td> </tr>
    911 
    912 <tr> <td colspan="2"> SHLIB_RPATH=rpath </td> <td> Specifies
    913 a non-default runpath for Postfix dynamically-linked libraries. The
    914 typical default is "'-Wl,-rpath,${SHLIB_DIR}'". </td> </tr>
    915 
    916 <tr> <td colspan="2"> SHLIB_SUFFIX=suffix </td> <td> Specifies
    917 a non-default suffix for Postfix dynamically-linked libraries and
    918 database plugins.  The typical default is "<tt>.so</tt>". </td>
    919 </tr>
    920 
    921 <tr> <td colspan="2"> WARN="warning_flags..." </td> <td> Specifies
    922 non-default compiler warning options for use when "<tt>make</tt>"
    923 is invoked in a source subdirectory only. </td>
    924 </tr>
    925 
    926 </table>
    927 
    928 <h3><a name="build_proc">4.8 - Support for thousands of processes</a></h3>
    929 
    930 <p> The number of connections that Postfix can manage simultaneously
    931 is limited by the number of processes that it can run.  This number
    932 in turn is limited by the number of files and sockets that a single
    933 process can open. For example, the Postfix queue manager has a
    934 separate connection to each delivery process, and the <a href="anvil.8.html">anvil(8)</a>
    935 server has one connection per <a href="smtpd.8.html">smtpd(8)</a> process. </p>
    936 
    937 <p> Postfix version 2.4 and later have no built-in limits on the
    938 number of open files or sockets, when compiled on systems that
    939 support one of the following: </p>
    940 
    941 <ul>
    942 
    943 <li> BSD kqueue(2) (FreeBSD 4.1, NetBSD 2.0, OpenBSD 2.9),
    944 
    945 <li> Solaris 8 /dev/poll,
    946 
    947 <li> Linux 2.6 epoll(4).
    948 
    949 </ul>
    950 
    951 
    952 <p> With other Postfix versions or operating systems, the number
    953 of file descriptors per process is limited by the value of the
    954 FD_SETSIZE macro. If you expect to run more than 1000 mail delivery
    955 processes, you may need to override the definition of the FD_SETSIZE
    956 macro to make select() work correctly: </p>
    957 
    958 <blockquote>
    959 <pre>
    960 $ make makefiles CCARGS=-DFD_SETSIZE=2048
    961 </pre>
    962 </blockquote>
    963 
    964 <p> Warning: the above has no effect on some Linux versions.
    965 Apparently, on these systems the FD_SETSIZE value can be changed
    966 only by using undocumented interfaces. Currently, that means
    967 including &lt;bits/types.h&gt; directly (which is not allowed) and
    968 overriding the __FD_SETSIZE macro. Beware, undocumented interfaces
    969 can change at any time and without warning. </p>
    970 
    971 <p> But wait, there is more: none of this will work unless the
    972 operating system is configured to handle thousands of connections.
    973 See the <a href="TUNING_README.html">TUNING_README</a> guide for examples of how to increase the
    974 number of open sockets or files. </p>
    975 
    976 <h3><a name="build_final">4.9 - Compiling Postfix, at last</a></h3>
    977 
    978 <p> If the command </p>
    979 
    980 <blockquote>
    981 <pre>
    982 $ make
    983 </pre>
    984 </blockquote>
    985 
    986 <p> is successful, then you can proceed to <a href="#install">install</a>
    987 Postfix (section 6).
    988 
    989 <p> If the command produces compiler error messages, it may be time
    990 to search the web or to ask the postfix-users (a] postfix.org mailing
    991 list, but be sure to search the mailing list archives first. Some
    992 mailing list archives are linked from <a href="https://www.postfix.org/">https://www.postfix.org/</a>. </p>
    993 
    994 <h2> <a name="5">5 - Porting Postfix to an unsupported system</a> </h2>
    995 
    996 <p> Each system type that Postfix knows is identified by a unique
    997 name. Examples:  SUNOS5, FREEBSD4, and so on.  When porting Postfix
    998 to a new system, the first step is to choose a SYSTEMTYPE name for
    999 the new system. You must use a name that includes at least the
   1000 major version of the operating system (such as SUNOS4 or LINUX2),
   1001 so that different releases of the same system can be supported
   1002 without confusion.  </p>
   1003 
   1004 <p> Add a case statement to the "makedefs" shell script in the
   1005 source code top-level directory that recognizes the new system
   1006 reliably, and that emits the right system-specific information.
   1007 Be sure to make the code robust against user PATH settings; if the
   1008 system offers multiple UNIX flavors (e.g. BSD and SYSV) be sure to
   1009 build for the native flavor, instead of the emulated one. </p>
   1010 
   1011 <p> Add an "#ifdef SYSTEMTYPE" section to the central util/sys_defs.h
   1012 include file.  You may have to invent new feature macro names.
   1013 Please choose sensible feature macro names such as HAS_DBM or
   1014 FIONREAD_IN_SYS_FILIO_H.  
   1015 
   1016 <p> I strongly recommend against using "#ifdef SYSTEMTYPE" in
   1017 individual source files.  While this may look like the quickest
   1018 solution, it will create a mess when newer versions of the same
   1019 SYSTEMTYPE need to be supported.  You're likely to end up placing
   1020 "#ifdef" sections all over the source code again.  </p>
   1021 
   1022 <h2><a name="install">6 - Installing the software after successful
   1023 compilation</a></h2>
   1024 
   1025 <p> This text describes how to install Postfix from source code.
   1026 See the <a href="PACKAGE_README.html">PACKAGE_README</a> file if you are building a package for
   1027 distribution to other systems. </p>
   1028 
   1029 <h3>6.1 - Save existing Sendmail binaries</h3>
   1030 
   1031 <p> <a name="save">IMPORTANT</a>: if you are REPLACING an existing
   1032 Sendmail installation with Postfix, you may need to keep the old
   1033 sendmail program running for some time in order to flush the mail
   1034 queue. </p>
   1035 
   1036 <ul>
   1037 
   1038 <li> <p> Some systems implement a mail switch mechanism where
   1039 different MTAs (Postfix, Sendmail, etc.) can be installed at the
   1040 same time, while only one of them is actually being used. Examples
   1041 of such switching mechanisms are the FreeBSD mailwrapper(8) or the
   1042 Linux mail switch.  In this case you should try to "flip" the switch
   1043 to "Postfix" before installing Postfix. </p>
   1044 
   1045 <li> <p> If your system has no mail switch mechanism, execute the
   1046 following commands (your sendmail, newaliases and mailq programs
   1047 may be in a different place): </p>
   1048 
   1049 <pre>
   1050 # mv /usr/sbin/sendmail /usr/sbin/sendmail.OFF
   1051 # mv /usr/bin/newaliases /usr/bin/newaliases.OFF
   1052 # mv /usr/bin/mailq /usr/bin/mailq.OFF
   1053 # chmod 755 /usr/sbin/sendmail.OFF /usr/bin/newaliases.OFF \
   1054     /usr/bin/mailq.OFF
   1055 </pre>
   1056 
   1057 </ul>
   1058 
   1059 <h3>6.2 - Create account and groups</h3>
   1060 
   1061 <p> Before you install Postfix for the first time you need to
   1062 create an account and a group:</p>
   1063 
   1064 <ul>
   1065 
   1066 <li> <p> Create a user account "postfix" with a user id and group
   1067 id that are not used by any other user account.  Preferably, this
   1068 is an account that no-one can log into.  The account does not need
   1069 an executable login shell, and needs no existing home directory.
   1070 My password and group file entries look like this: </p>
   1071 
   1072 <blockquote>
   1073 <pre>
   1074 /etc/passwd:
   1075     postfix:*:12345:12345:postfix:/no/where:/no/shell
   1076 
   1077 /etc/group:
   1078     postfix:*:12345:
   1079 </pre>
   1080 </blockquote>
   1081 
   1082 <p> Note: there should be no whitespace before "postfix:". </p>
   1083 
   1084 <li> <p> Create a group "postdrop" with a group id that is not used
   1085 by any other user account. Not even by the postfix user account.
   1086 My group file entry looks like:
   1087 
   1088 <blockquote>
   1089 <pre>
   1090 /etc/group:
   1091     postdrop:*:54321:
   1092 </pre>
   1093 </blockquote>
   1094 
   1095 <p> Note: there should be no whitespace before "postdrop:". </p>
   1096 
   1097 </ul>
   1098 
   1099 <h3>6.3 - Install Postfix</h3>
   1100 
   1101 <p> To install or upgrade Postfix from compiled source code, run
   1102 one of the following commands as the super-user:</p>
   1103 
   1104 <blockquote>
   1105 <pre>
   1106 # make install       (interactive version, first time install)
   1107 
   1108 # make upgrade       (non-interactive version, for upgrades)
   1109 </pre>
   1110 </blockquote>
   1111 
   1112 <ul>
   1113 
   1114 <li> <p> The interactive version ("make install") asks for pathnames
   1115 for Postfix data and program files, and stores your preferences in
   1116 the <a href="postconf.5.html">main.cf</a> file. <b> If you don't want Postfix to overwrite
   1117 non-Postfix "sendmail", "mailq" and "newaliases" files, specify
   1118 pathnames that end in ".postfix"</b>. </p>
   1119 
   1120 <li> <p> The non-interactive version ("make upgrade") needs the
   1121 /etc/postfix/<a href="postconf.5.html">main.cf</a> file from a previous installation. If the file
   1122 does not exist, use interactive installation ("make install")
   1123 instead. </p>
   1124 
   1125 <li> <p> If you specify name=value arguments on the "make install"
   1126 or "make upgrade" command line, then these will take precedence
   1127 over compiled-in default settings or <a href="postconf.5.html">main.cf</a> settings. </p>
   1128 
   1129 <p> The command "make install/upgrade name=value ..." will replace
   1130 the string MAIL_VERSION at the end of a configuration parameter
   1131 value with the Postfix release version. Do not try to specify
   1132 something like $<a href="postconf.5.html#mail_version">mail_version</a> on this command line. This produces
   1133 inconsistent results with different versions of the make(1) command.
   1134 </p>
   1135 
   1136 </ul>
   1137 
   1138 <h3>6.4 - Configure Postfix</h3>
   1139 
   1140 <p> Proceed to the section on how you wish to run Postfix on
   1141 your particular machine: </p>
   1142 
   1143 <ul>
   1144 
   1145 <li> <p> <a href="#send_only">Send</a> mail only, without changing
   1146 an existing Sendmail installation (section 7). </p>
   1147 
   1148 <li> <p> <a href="#send_receive">Send and receive</a> mail via a
   1149 virtual host interface, still without any change to an existing
   1150 Sendmail installation (section 8). </p>
   1151 
   1152 <li> <p> Run Postfix <a href="#replace">instead of</a> Sendmail
   1153 (section 9). </p>
   1154 
   1155 </ul>
   1156 
   1157 <h2><a name="send_only">7 - Configuring Postfix to send mail
   1158 only</a></h2>
   1159 
   1160 <p> If you are going to use Postfix to send mail only, there is no
   1161 need to change your existing sendmail setup. Instead, set up your
   1162 mail user agent so that it calls the Postfix sendmail program
   1163 directly. </p>
   1164 
   1165 <p> Follow the instructions in the "<a href="#mandatory">Mandatory
   1166 configuration file edits</a>" in section 10, and review the "<a
   1167 href="#hamlet">To chroot or not to chroot</a>" text in section
   1168 11. </p>
   1169 
   1170 <p> You MUST comment out the "smtp inet" entry in /etc/postfix/<a href="master.5.html">master.cf</a>,
   1171 in order to avoid conflicts with the real sendmail. Put a "#"
   1172 character in front of the line that defines the smtpd service: </p>
   1173 
   1174 <blockquote>
   1175 <pre>
   1176 /etc/postfix/<a href="master.5.html">master.cf</a>:
   1177     #smtp      inet  n       -       n       -       -       smtpd
   1178 </pre>
   1179 </blockquote>
   1180 
   1181 <p> Start the Postfix system: </p>
   1182 
   1183 <blockquote>
   1184 <pre>
   1185 # postfix start
   1186 </pre>
   1187 </blockquote>
   1188 
   1189 <p> or, if you feel nostalgic, use the Postfix sendmail command: </p>
   1190 
   1191 <blockquote>
   1192 <pre>
   1193 # sendmail -bd -qwhatever
   1194 </pre>
   1195 </blockquote>
   1196 
   1197 <p> and watch your maillog file for any error messages. The pathname
   1198 is /var/log/maillog, /var/log/mail, /var/log/syslog, or something
   1199 else. Typically, the pathname is defined in the /etc/syslog.conf
   1200 file. </p>
   1201 
   1202 <blockquote>
   1203 <pre>
   1204 $ grep -E '(reject|warning|error|fatal|panic):' /some/log/file
   1205 </pre>
   1206 </blockquote>
   1207 
   1208 <p> Note: the most important error message is logged first. Later
   1209 messages are not as useful. </p>
   1210 
   1211 <p> In order to inspect the mail queue, use one of the following
   1212 commands: </p>
   1213 
   1214 <blockquote>
   1215 <pre>
   1216 $ mailq
   1217 
   1218 $ sendmail -bp
   1219 
   1220 $ postqueue -p
   1221 </pre>
   1222 </blockquote>
   1223 
   1224 <p> See also the "<a href="#care">Care and feeding</a>" section 12
   1225 below.  </p>
   1226 
   1227 <h2><a name="send_receive">8 - Configuring Postfix to send and
   1228 receive mail via virtual interface</a></h2>
   1229 
   1230 <p> Alternatively, you can use the Postfix system to send AND
   1231 receive mail while leaving your Sendmail setup intact, by running
   1232 Postfix on a virtual interface address.  Simply configure your mail
   1233 user agent to directly invoke the Postfix sendmail program.  </p>
   1234 
   1235 <p> To create a virtual network interface address, study your
   1236 system ifconfig manual page. The command syntax could be any
   1237 of: </p>
   1238 
   1239 <blockquote>
   1240 <pre>
   1241 # <b>ifconfig le0:1 &lt;address&gt; netmask &lt;mask&gt; up</b>
   1242 # <b>ifconfig en0 alias &lt;address&gt; netmask 255.255.255.255</b>
   1243 </pre>
   1244 </blockquote>
   1245 
   1246 <p> In the /etc/postfix/<a href="postconf.5.html">main.cf</a> file, I would specify </p>
   1247 
   1248 <blockquote>
   1249 <pre>
   1250 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1251     <a href="postconf.5.html#myhostname">myhostname</a> = virtual.host.tld
   1252     <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> = $<a href="postconf.5.html#myhostname">myhostname</a>
   1253     <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a>
   1254 </pre>
   1255 </blockquote>
   1256 
   1257 <p> Follow the instructions in the "<a href="#mandatory">Mandatory
   1258 configuration file edits</a>" in section 10, and review the "<a
   1259 href="#hamlet">To chroot or not to chroot</a>" text in section
   1260 11. </p>
   1261 
   1262 <p> Start the Postfix system: </p>
   1263 
   1264 <blockquote>
   1265 <pre>
   1266 # postfix start
   1267 </pre>
   1268 </blockquote>
   1269 
   1270 <p> or, if you feel nostalgic, use the Postfix sendmail command: </p>
   1271 
   1272 <blockquote>
   1273 <pre>
   1274 # sendmail -bd -qwhatever
   1275 </pre>
   1276 </blockquote>
   1277 
   1278 <p> and watch your maillog file for any error messages. The pathname
   1279 is /var/log/maillog, /var/log/mail, /var/log/syslog, or something
   1280 else. Typically, the pathname is defined in the /etc/syslog.conf
   1281 file. </p>
   1282 
   1283 <blockquote>
   1284 <pre>
   1285 $ grep -E '(reject|warning|error|fatal|panic):' /some/log/file
   1286 </pre>
   1287 </blockquote>
   1288 
   1289 <p> Note: the most important error message is logged first. Later
   1290 messages are not as useful. </p>
   1291 
   1292 <p> In order to inspect the mail queue, use one of the following
   1293 commands: </p>
   1294 
   1295 <blockquote>
   1296 <pre>
   1297 $ mailq
   1298 
   1299 $ sendmail -bp
   1300 
   1301 $ postqueue -p
   1302 </pre>
   1303 </blockquote>
   1304 
   1305 <p> See also the "<a href="#care">Care and feeding</a>" section 12
   1306 below.  </p>
   1307 
   1308 <h2><a name="replace">9 - Running Postfix instead of Sendmail</a></h2>
   1309 
   1310 <p> Prior to installing Postfix you should <a href="#save">save</a>
   1311 any existing sendmail program files as described in section 6.  Be
   1312 sure to keep the old sendmail running for at least a couple days
   1313 to flush any unsent mail. To do so, stop the sendmail daemon and
   1314 restart it as: </p>
   1315 
   1316 <blockquote>
   1317 <pre>
   1318 # /usr/sbin/sendmail.OFF -q
   1319 </pre>
   1320 </blockquote>
   1321 
   1322 <p> Note: this is old sendmail syntax. Newer versions use separate
   1323 processes for mail submission and for running the queue. </p>
   1324 
   1325 <p> After you have visited the "<a href="#mandatory">Mandatory
   1326 configuration file edits</a>" section below, you can start the
   1327 Postfix system with: </p>
   1328 
   1329 <blockquote>
   1330 <pre>
   1331 # postfix start
   1332 </pre>
   1333 </blockquote>
   1334 
   1335 <p> or, if you feel nostalgic, use the Postfix sendmail command: </p>
   1336 
   1337 <blockquote>
   1338 <pre>
   1339 # sendmail -bd -qwhatever
   1340 </pre>
   1341 </blockquote>
   1342 
   1343 <p> and watch your maillog file for any error messages. The pathname
   1344 is /var/log/maillog, /var/log/mail, /var/log/syslog, or something
   1345 else. Typically, the pathname is defined in the /etc/syslog.conf
   1346 file. </p>
   1347 
   1348 <blockquote>
   1349 <pre>
   1350 $ grep -E '(reject|warning|error|fatal|panic):' /some/log/file
   1351 </pre>
   1352 </blockquote>
   1353 
   1354 <p> Note: the most important error message is logged first. Later
   1355 messages are not as useful. </p>
   1356 
   1357 <p> In order to inspect the mail queue, use one of the following
   1358 commands: </p>
   1359 
   1360 <blockquote>
   1361 <pre>
   1362 $ mailq
   1363 
   1364 $ sendmail -bp
   1365 
   1366 $ postqueue -p
   1367 </pre>
   1368 </blockquote>
   1369 
   1370 <p> See also the "<a href="#care">Care and feeding</a>" section 12
   1371 below.  </p>
   1372 
   1373 <h2><a name="mandatory">10 - Mandatory configuration file edits</a></h2>
   1374 
   1375 <p> Note: the material covered in this section is covered in more
   1376 detail in the <a href="BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README</a> document. The information
   1377 presented below is targeted at experienced system administrators.
   1378 </p>
   1379 
   1380 <h3>10.1 - Postfix configuration files</h3>
   1381 
   1382 <p> By default, Postfix configuration files are in /etc/postfix.
   1383 The two most important files are <a href="postconf.5.html">main.cf</a> and <a href="master.5.html">master.cf</a>; these files
   1384 must be owned by root.  Giving someone else write permission to
   1385 <a href="postconf.5.html">main.cf</a> or <a href="master.5.html">master.cf</a> (or to their parent directories) means giving
   1386 root privileges to that person. </p>
   1387 
   1388 <p> In /etc/postfix/<a href="postconf.5.html">main.cf</a>, you will have to set up a minimal number
   1389 of configuration parameters.  Postfix configuration parameters  
   1390 resemble shell variables, with two important differences: the first  
   1391 one is that Postfix does not know about quotes like the UNIX shell
   1392 does.</p>
   1393 
   1394 <p> You specify a configuration parameter as: </p>
   1395 
   1396 <blockquote>
   1397 <pre>
   1398 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1399     parameter = value
   1400 </pre>
   1401 </blockquote>
   1402 
   1403 <p> and you use it by putting a "$" character in front of its name: </p>
   1404 
   1405 <blockquote>
   1406 <pre>
   1407 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1408     other_parameter = $parameter
   1409 </pre>
   1410 </blockquote>
   1411 
   1412 <p> You can use $parameter before it is given a value (that is the
   1413 second main difference with UNIX shell variables). The Postfix
   1414 configuration language uses lazy evaluation, and does not look at
   1415 a parameter value until it is needed at runtime.  </p>
   1416 
   1417 <p> Whenever you make a change to the <a href="postconf.5.html">main.cf</a> or <a href="master.5.html">master.cf</a> file,
   1418 execute the following command in order to refresh a running mail
   1419 system: </p>
   1420 
   1421 <blockquote>
   1422 <pre>
   1423 # postfix reload
   1424 </pre>
   1425 </blockquote>
   1426 
   1427 <h3>10.2 - Default domain for unqualified addresses</h3>
   1428 
   1429 <p> First of all, you must specify what domain will be appended to an
   1430 unqualified address (i.e. an address without @domain.tld). The
   1431 "<a href="postconf.5.html#myorigin">myorigin</a>" parameter defaults to the local hostname, but that is
   1432 probably OK only for very small sites.  </p>
   1433 
   1434 <p> Some examples (use only one): </p>
   1435 
   1436 <blockquote>
   1437 <pre>
   1438 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1439     <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#myhostname">myhostname</a>    (send mail as "user@$<a href="postconf.5.html#myhostname">myhostname</a>")
   1440     <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>      (send mail as "user@$<a href="postconf.5.html#mydomain">mydomain</a>")
   1441 </pre>
   1442 </blockquote>
   1443 
   1444 <h3>10.3 - What domains to receive locally</h3>
   1445 
   1446 <p> Next you need to specify what mail addresses Postfix should deliver
   1447 locally. </p>
   1448 
   1449 <p> Some examples (use only one): </p>
   1450 
   1451 <blockquote>
   1452 <pre>
   1453 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1454     <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a>, localhost.$<a href="postconf.5.html#mydomain">mydomain</a>, localhost
   1455     <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a>, localhost.$<a href="postconf.5.html#mydomain">mydomain</a>, localhost, $<a href="postconf.5.html#mydomain">mydomain</a>
   1456     <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a>
   1457 </pre>
   1458 </blockquote>
   1459 
   1460 <p>The first example is appropriate for a workstation, the second
   1461 is appropriate for the mailserver for an entire domain. The third
   1462 example should be used when running on a virtual host interface.</p>
   1463 
   1464 <h3>10.4 - Proxy/NAT interface addresses </h3>
   1465 
   1466 <p> The <a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> parameter specifies all network addresses
   1467 that Postfix receives mail on by way of a proxy or network address
   1468 translation unit. You may specify symbolic hostnames instead of
   1469 network addresses. </p>
   1470 
   1471 <p> IMPORTANT: You must specify your proxy/NAT external addresses
   1472 when your system is a backup MX host for other domains, otherwise
   1473 mail delivery loops will happen when the primary MX host is down.
   1474 </p>
   1475 
   1476 <p> Example: host behind NAT box running a backup MX host. </p>
   1477 
   1478 <blockquote>
   1479 <pre>
   1480 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1481     <a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> = 1.2.3.4 (the proxy/NAT external network address)
   1482 </pre>
   1483 </blockquote>
   1484 
   1485 <h3>10.5 - What local clients to relay mail from </h3>
   1486 
   1487 <p> If your machine is on an open network then you must specify
   1488 what client IP addresses are authorized to relay their mail through
   1489 your machine into the Internet.  The default setting includes all
   1490 subnetworks that the machine is attached to. This may give relay
   1491 permission to too many clients.  My own settings are: </p>
   1492 
   1493 <blockquote>
   1494 <pre>
   1495 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1496     <a href="postconf.5.html#mynetworks">mynetworks</a> = 168.100.189.0/28, 127.0.0.0/8
   1497 </pre>
   1498 </blockquote>
   1499 
   1500 <h3>10.6 - What relay destinations to accept from strangers </h3>
   1501 
   1502 <p> If your machine is on an open network then you must also specify
   1503 whether Postfix will forward mail from strangers.  The default
   1504 setting will forward mail to all domains (and subdomains of) what
   1505 is listed in $<a href="postconf.5.html#mydestination">mydestination</a>.  This may give relay permission for
   1506 too many destinations.  Recommended settings (use only one): </p>
   1507 
   1508 <blockquote>
   1509 <pre>
   1510 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1511     <a href="postconf.5.html#relay_domains">relay_domains</a> =            (do not forward mail from strangers)
   1512     <a href="postconf.5.html#relay_domains">relay_domains</a> = $<a href="postconf.5.html#mydomain">mydomain</a>  (my domain and subdomains)
   1513     <a href="postconf.5.html#relay_domains">relay_domains</a> = $<a href="postconf.5.html#mydomain">mydomain</a>, other.domain.tld, ...
   1514 </pre>
   1515 </blockquote>
   1516 
   1517 <h3>10.7 - Optional: configure a smart host for remote delivery</h3>
   1518 
   1519 <p> If you're behind a firewall, you should set up a <a href="postconf.5.html#relayhost">relayhost</a>.  If
   1520 you can, specify the organizational domain name so that Postfix
   1521 can use DNS lookups, and so that it can fall back to a secondary
   1522 MX host when the primary MX host is down. Otherwise just specify
   1523 a hard-coded hostname.  </p>
   1524 
   1525 <p> Some examples (use only one): </p>
   1526 
   1527 <blockquote>
   1528 <pre>
   1529 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1530     <a href="postconf.5.html#relayhost">relayhost</a> = $<a href="postconf.5.html#mydomain">mydomain</a>
   1531     <a href="postconf.5.html#relayhost">relayhost</a> = [mail.$<a href="postconf.5.html#mydomain">mydomain</a>]
   1532 </pre>
   1533 </blockquote>
   1534 
   1535 <p> The form enclosed with <tt>[]</tt> eliminates DNS MX lookups. </p>
   1536 
   1537 <p> By default, the SMTP client will do DNS lookups even when you
   1538 specify a <a href="postconf.5.html#relayhost">relay host</a>. If your machine has no access to a DNS server,
   1539 turn off SMTP client DNS lookups like this: </p>
   1540 
   1541 <blockquote>
   1542 <pre>
   1543 /etc/postfix/<a href="postconf.5.html">main.cf</a>:
   1544     <a href="postconf.5.html#disable_dns_lookups">disable_dns_lookups</a> = yes
   1545 </pre>
   1546 </blockquote>
   1547 
   1548 <p> The <a href="STANDARD_CONFIGURATION_README.html">STANDARD_CONFIGURATION_README</a> file has more hints and tips for
   1549 firewalled and/or dial-up networks. </p>
   1550 
   1551 <h3>10.8 - Create the aliases database</h3>
   1552 
   1553 <p> Postfix uses a Sendmail-compatible <a href="aliases.5.html">aliases(5)</a> table to redirect
   1554 mail for <a href="local.8.html">local(8)</a> recipients.  Typically, this information is kept
   1555 in two files: in a text file /etc/aliases and in an indexed file
   1556 /etc/aliases.db.  The command "postconf <a href="postconf.5.html#alias_maps">alias_maps</a>" will tell you
   1557 the exact location of the text file.  </p>
   1558 
   1559 <p> First, be sure to update the text file with aliases for root,
   1560 postmaster and "postfix" that forward mail to a real person.  Postfix
   1561 has a sample aliases file /etc/postfix/aliases that you can copy
   1562 and adapt to local conditions.  /p>
   1563 
   1564 <blockquote>
   1565 <pre>
   1566 /etc/aliases:
   1567     root: you
   1568     postmaster: root
   1569     postfix: root
   1570     bin: root
   1571     <i>etcetera...</i>
   1572 </pre>
   1573 </blockquote>
   1574 
   1575 <p> Note: there should be no whitespace before the ":". </p>
   1576 
   1577 <p> Finally, build the indexed aliases file with one of the
   1578 following commands: </p>
   1579 
   1580 <blockquote>
   1581 <pre>
   1582 # newaliases
   1583 # sendmail -bi
   1584 # postalias /etc/aliases (pathname is system dependent!)
   1585 </pre>
   1586 </blockquote>
   1587 
   1588 <p> The form "postalias /etc/aliases" builds a default-type indexed
   1589 file. Use "postalias <i>type</i>:/etc/aliases" to specify an explicit
   1590 type (it should match the type in the output from "postconf -x
   1591 <a href="postconf.5.html#alias_maps">alias_maps</a>"). </p>
   1592 
   1593 <p> The default indexed file type is configured with the
   1594 <a href="postconf.5.html#default_database_type">default_database_type</a> parameter. To list available explicit types, 
   1595 execute the command "<b>postconf -m</b>".</p>
   1596 
   1597 <h2><a name="hamlet">11 - To chroot or not to chroot</a></h2>
   1598 
   1599 <p> Postfix daemon processes can be configured (via <a href="master.5.html">master.cf</a>) to
   1600 run in a chroot jail.  The processes run at a fixed low privilege
   1601 and with access only to the Postfix queue directories (/var/spool/postfix).
   1602 This provides a significant barrier against intrusion. The barrier
   1603 is not impenetrable, but every little bit helps. </p>
   1604 
   1605 <p> With the exception of Postfix daemons that deliver mail locally
   1606 and/or that execute non-Postfix commands, every Postfix daemon can
   1607 run chrooted. </p>
   1608 
   1609 <p> Sites with high security requirements should consider to chroot
   1610 all daemons that talk to the network:  the <a href="smtp.8.html">smtp(8)</a> and <a href="smtpd.8.html">smtpd(8)</a>
   1611 processes, and perhaps also the <a href="lmtp.8.html">lmtp(8)</a> client. The author's own
   1612 porcupine.org mail server runs all daemons chrooted that can be
   1613 chrooted. </p>
   1614 
   1615 <p> The default /etc/postfix/<a href="master.5.html">master.cf</a> file specifies that no
   1616 Postfix daemon runs chrooted.  In order to enable chroot operation,
   1617 edit the file /etc/postfix/<a href="master.5.html">master.cf</a>. Instructions are in the file.
   1618 </p>
   1619 
   1620 <p> Note that a chrooted daemon resolves all filenames relative to
   1621 the Postfix queue directory (/var/spool/postfix). For successful
   1622 use of a chroot jail,  most UNIX systems require you to bring in
   1623 some files or device nodes.  The examples/chroot-setup directory
   1624 in the source code distribution has a collection of scripts that
   1625 help you set up Postfix chroot environments on different operating
   1626 systems. </p>
   1627 
   1628 <p> Additionally, you almost certainly need to configure syslogd
   1629 so that it listens on a socket inside the Postfix queue directory.
   1630 Examples for specific systems: </p>
   1631 
   1632 <dl>
   1633 
   1634 <dt> FreeBSD: </dt>
   1635 
   1636 <dd> <pre>
   1637 # mkdir -p /var/spool/postfix/var/run
   1638 # syslogd -l /var/spool/postfix/var/run/log
   1639 </pre> </dd>
   1640 
   1641 <dt> Linux, OpenBSD: </dt>
   1642 
   1643 <dd> <pre>
   1644 # mkdir -p /var/spool/postfix/dev
   1645 # syslogd -a /var/spool/postfix/dev/log
   1646 </pre> </dd>
   1647 
   1648 </dl>
   1649 
   1650 <h2><a name="care">12 - Care and feeding of the Postfix system</a></h2>
   1651 
   1652 <p> Postfix daemon processes run in the background, and log problems
   1653 and normal activity to the syslog daemon. The names of logfiles
   1654 are specified in /etc/syslog.conf. At the very least you need
   1655 something like:  </p>
   1656 
   1657 <blockquote>
   1658 <pre>
   1659 /etc/syslog.conf:
   1660     mail.err                                    /dev/console
   1661     mail.debug                                  /var/log/maillog
   1662 </pre>
   1663 </blockquote>
   1664 
   1665 <p> IMPORTANT: the syslogd will not create files. You must create
   1666 them before (re)starting syslogd. </p>
   1667 
   1668 <p> IMPORTANT: on Linux you need to put a "-" character before
   1669 the pathname, e.g., -/var/log/maillog, otherwise the syslogd
   1670 will use more system resources than Postfix does. </p>
   1671 
   1672 <p> Hopefully, the number of problems will be small, but it is a good
   1673 idea to run every night before the syslog files are rotated: </p>
   1674 
   1675 <blockquote>
   1676 <pre>
   1677 # postfix check
   1678 # grep -E '(reject|warning|error|fatal|panic):' /some/log/file
   1679 </pre>
   1680 </blockquote>
   1681 
   1682 <ul>
   1683 
   1684 <li> <p> The first line (postfix check) causes Postfix to report
   1685 file permission/ownership discrepancies. </p>
   1686 
   1687 <li> <p> The second line looks for problem reports from the mail
   1688 software, and reports how effective the relay and junk mail access
   1689 blocks are.  This may produce a lot of output.  You will want to
   1690 apply some postprocessing to eliminate uninteresting information.
   1691 </p>
   1692 
   1693 </ul>
   1694 
   1695 <p>  The <a href="DEBUG_README.html#logging"> DEBUG_README </a>
   1696 document describes the meaning of the "warning" etc. labels in
   1697 Postfix logging. </p>
   1698 
   1699 </body>
   1700 
   1701 </html>
   1702