1 <!doctype html public
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
8 <title>Postfix Installation From Source Code
</title>
10 <meta http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii">
16 <h1><img src=
"postfix-logo.jpg" width=
"203" height=
"98" ALT=
"">Postfix
17 Installation From Source Code
</h1>
21 <h2> <a name=
"1">1 - Purpose of this document
</a> </h2>
23 <p> If you are using a pre-compiled version of Postfix, you should
24 start with
<a href=
"BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README
</a> and the general documentation
25 referenced by it.
<a href=
"INSTALL.html">INSTALL
</a> is only a bootstrap document to get
26 Postfix up and running from scratch with the minimal number of
27 steps; it should not be considered part of the general documentation.
30 <p> This document describes how to build, install and configure a
31 Postfix system so that it can do one of the following:
</p>
35 <li> Send mail only, without changing an existing Sendmail
38 <li> Send and receive mail via a virtual host interface, still
39 without any change to an existing Sendmail installation.
41 <li> Run Postfix instead of Sendmail.
45 <p> Topics covered in this document:
</p>
49 <li> <a href=
"#1">Purpose of this document
</a>
51 <li> <a href=
"#2">Typographical conventions
</a>
53 <li> <a href=
"#3">Documentation
</a>
55 <li> <a href=
"#4">Building on a supported system
</a>
57 <li> <a href=
"#5">Porting Postfix to an unsupported system
</a>
59 <li> <a href=
"#install">Installing the software after successful
62 <li> <a href=
"#send_only">Configuring Postfix to send mail
65 <li> <a href=
"#send_receive">Configuring Postfix to send and
66 receive mail via virtual interface
</a>
68 <li> <a href=
"#replace">Running Postfix instead of Sendmail
</a>
70 <li> <a href=
"#mandatory">Mandatory configuration file edits
</a>
72 <li> <a href=
"#hamlet">To chroot or not to chroot
</a>
74 <li> <a href=
"#care">Care and feeding of the Postfix system
</a>
78 <h2> <a name=
"2">2 - Typographical conventions
</a> </h2>
80 <p> In the instructions below, a command written as
</p>
88 <p> should be executed as the superuser.
</p>
90 <p> A command written as
</p>
98 <p> should be executed as an unprivileged user.
</p>
100 <h2> <a name=
"3">3 - Documentation
</a> </h2>
102 <p> Documentation is available as README files (start with the file
103 README_FILES/AAAREADME), as HTML web pages (point your browser to
104 "html/index.html") and as UNIX-style manual pages.
</p>
106 <p> You should view the README files with a pager such as more(
1)
107 or less(
1), because the files use backspace characters in order to
108 produce
<b>bold
</b> font. To print a README file without backspace
109 characters, use the col(
1) command. For example:
</p>
113 % col -bx
<file | lpr
117 <p> In order to view the manual pages before installing Postfix,
118 point your MANPATH environment variable to the
"man" subdirectory;
119 be sure to use an absolute path.
</p>
123 % export MANPATH;
MANPATH=
"`pwd`/man:$MANPATH"
124 % setenv MANPATH
"`pwd`/man:$MANPATH"
128 <p> Of particular interest is the
<a href=
"postconf.5.html">postconf(
5)
</a> manual page that
129 lists all the
500+ configuration parameters. The HTML version of
130 this text makes it easy to navigate around.
</p>
132 <p> All Postfix source files have their own built-in manual page.
133 Tools to extract those embedded manual pages are available in the
134 mantools directory.
</p>
136 <h2> <a name=
"4">4 - Building on a supported system
</a> </h2>
138 <p> At some point in time, a version of Postfix was supported on:
</p>
142 AIX
3.2.5,
4.1.x,
4.2.0,
4.3.x,
5.2 <br>
143 BSD/OS
2.x,
3.x,
4.x
<br>
145 FreeBSD
2.x,
3.x,
4.x,
5.x
<br>
146 HP-UX
9.x,
10.x,
11.x
<br>
148 Linux Debian
1.3.1,
2.x,
3.x
<br>
149 Linux RedHat
3.x (January
2004) -
9.x
<br>
150 Linux Slackware
3.x,
4.x,
7.x
<br>
151 Linux SuSE
5.x,
6.x,
7.x
<br>
152 Linux Ubuntu
4.10.
.7.04<br>
157 OSF1.V3 - OSF1.V5 (Digital UNIX)
<br>
158 Reliant UNIX
5.x
<br>
160 SunOS
4.1.4 (March
2007)
<br>
161 SunOS
5.4 -
5.10 (Solaris
2.4.
.10)
<br>
162 Ultrix
4.x (well, that was long ago)
<br>
166 <p> or something closely resemblant.
</p>
168 <h3>4.1 - Getting started
</h3>
170 <p> On Solaris, the
"make" command and other utilities for software
171 development are in /usr/ccs/bin, so you MUST have /usr/ccs/bin in
172 your command search path. If these files do not exist, install the
173 development packages first. See the Solaris FAQ item
"<a
174 href="http://www.science.uva.nl/pub/solaris/solaris2.html#q6.2
">Which
175 packages do I need to install to support a C compiler?</a>".
</p>
177 <p> If you need to build Postfix for multiple architectures, use the
178 "lndir" command to build a shadow tree with symbolic links to the
179 source files.
"lndir" is part of X11R6.
</p>
181 <p> If at any time in the build process you get messages like:
"make:
182 don't know how to ..." you should be able to recover by running
183 the following command from the Postfix top-level directory:
</p>
187 % make -f Makefile.init makefiles
191 <p> If you copied the Postfix source code after building it on another
192 machine, it is a good idea to cd into the top-level directory and
201 <p> This will get rid of any system dependencies left over from
202 compiling the software elsewhere.
</p>
204 <h3>4.2 - What compiler to use
</h3>
206 <p> To build with GCC, or with the native compiler if people told me
207 that is better for your system, just cd into the top-level Postfix
208 directory of the source tree and type:
</p>
216 <p> To build with a non-default compiler, you need to specify the name
217 of the compiler. Here are a few examples:
</p>
221 % make makefiles CC=/opt/SUNWspro/bin/cc (Solaris)
224 % make makefiles
CC=
"/opt/ansic/bin/cc -Ae" (HP-UX)
227 % make makefiles
CC=
"purify cc"
232 <p> and so on. In some cases, optimization is turned off automatically.
</p>
234 <h3>4.3 - Building with optional extensions
</h3>
236 By default, Postfix builds as a mail system with relatively few
237 bells and whistles. Support for third-party databases etc.
238 must be configured when Postfix is compiled. The following documents describe how to build Postfix with support for extensions:
243 <tr> <th>Postfix extension
</th> <th>Document
</th> <th>Availability
</th>
246 <tr> <td> Berkeley DB database
</td> <td><a href=
"DB_README.html">DB_README
</a></td> <td> Postfix
249 <tr> <td> LDAP database
</td> <td><a href=
"LDAP_README.html">LDAP_README
</a></td> <td> Postfix
252 <tr> <td> MySQL database
</td> <td><a href=
"MYSQL_README.html">MYSQL_README
</a></td> <td> Postfix
255 <tr> <td> Perl compatible regular expression
</td> <td><a href=
"PCRE_README.html">PCRE_README
</a></td>
256 <td> Postfix
1.0 </td> </tr>
258 <tr> <td> PostgreSQL database
</td> <td><a href=
"PGSQL_README.html">PGSQL_README
</a></td> <td>
259 Postfix
2.0 </td> </tr>
261 <tr> <td> SASL authentication
</td> <td><a href=
"SASL_README.html">SASL_README
</a></td> <td>
262 Postfix
1.0 </td> </tr>
264 <tr> <td> STARTTLS session encryption
</td> <td><a href=
"TLS_README.html">TLS_README
</a></td> <td>
265 Postfix
2.2 </td> </tr>
271 <p> Note: IP version
6 support is compiled into Postfix on operating
272 systems that have IPv6 support. See the
<a href=
"IPV6_README.html">IPV6_README
</a> file for details.
275 <h3>4.4 - Overriding built-in parameter default settings
</h3>
277 <p> All Postfix configuration parameters can be changed by editing
278 a Postfix configuration file, except for one: the parameter that
279 specifies the location of Postfix configuration files. In order to
280 build Postfix with a configuration directory other than /etc/postfix,
285 % make makefiles CCARGS='-DDEF_CONFIG_DIR=\
"/some/where\"'
290 <p> IMPORTANT: Be sure to get the quotes right. These details matter
293 <p> Parameters whose defaults can be specified in this way are:
</p>
299 <tr><th> Macro name
</th> <th>default value for
</th> <th>typical
302 <tr> <td>DEF_COMMAND_DIR
</td> <td><a href=
"postconf.5.html#command_directory">command_directory
</a></td>
303 <td>/usr/sbin
</td> </tr>
305 <tr> <td>DEF_CONFIG_DIR
</td> <td><a href=
"postconf.5.html#config_directory">config_directory
</a></td>
306 <td>/etc/postfix
</td> </tr>
308 <tr> <td>DEF_DAEMON_DIR
</td> <td><a href=
"postconf.5.html#daemon_directory">daemon_directory
</a></td>
309 <td>/usr/libexec/postfix
</td> </tr>
311 <tr> <td>DEF_DATA_DIR
</td> <td><a href=
"postconf.5.html#data_directory">data_directory
</a></td>
312 <td>/var/db/postfix
</td> </tr>
314 <tr> <td>DEF_MAILQ_PATH
</td> <td><a href=
"postconf.5.html#mailq_path">mailq_path
</a></td> <td>/usr/bin/mailq
</td>
317 <tr> <td>DEF_HTML_DIR
</td> <td><a href=
"postconf.5.html#html_directory">html_directory
</a></td>
320 <tr> <td>DEF_MANPAGE_DIR
</td> <td><a href=
"postconf.5.html#manpage_directory">manpage_directory
</a></td>
321 <td>/usr/local/man
</td> </tr>
323 <tr> <td>DEF_NEWALIAS_PATH
</td> <td><a href=
"postconf.5.html#newaliases_path">newaliases_path
</a></td>
324 <td>/usr/bin/newaliases
</td> </tr>
326 <tr> <td>DEF_QUEUE_DIR
</td> <td><a href=
"postconf.5.html#queue_directory">queue_directory
</a></td>
327 <td>/var/spool/postfix
</td> </tr>
329 <tr> <td>DEF_README_DIR
</td> <td><a href=
"postconf.5.html#readme_directory">readme_directory
</a></td>
332 <tr> <td>DEF_SENDMAIL_PATH
</td> <td><a href=
"postconf.5.html#sendmail_path">sendmail_path
</a></td>
333 <td>/usr/sbin/sendmail
</td> </tr>
339 <p> Note: the
<a href=
"postconf.5.html#data_directory">data_directory
</a> parameter (for caches and pseudo-random
340 numbers) was introduced with Postfix version
2.5.
</p>
342 <h3>4.5 - Support for thousands of processes
</h3>
344 <p> The number of connections that Postfix can manage simultaneously
345 is limited by the number of processes that it can run. This number
346 in turn is limited by the number of files and sockets that a single
347 process can open. For example, the Postfix queue manager has a
348 separate connection to each delivery process, and the
<a href=
"anvil.8.html">anvil(
8)
</a>
349 server has one connection per
<a href=
"smtpd.8.html">smtpd(
8)
</a> process.
</p>
351 <p> Postfix version
2.4 and later have no built-in limits on the
352 number of open files or sockets, when compiled on systems that
353 support one of the following:
</p>
357 <li> BSD kqueue(
2) (FreeBSD
4.1, NetBSD
2.0, OpenBSD
2.9),
359 <li> Solaris
8 /dev/poll,
361 <li> Linux
2.6 epoll(
4).
366 <p> With other Postfix versions or operating systems, the number
367 of file descriptors per process is limited by the value of the
368 FD_SETSIZE macro. If you expect to run more than
1000 mail delivery
369 processes, you may need to override the definition of the FD_SETSIZE
370 macro to make select() work correctly:
</p>
374 % make makefiles CCARGS=-DFD_SETSIZE=
2048
378 <p> Warning: the above has no effect on some Linux versions.
379 Apparently, on these systems the FD_SETSIZE value can be changed
380 only by using undocumented interfaces. Currently, that means
381 including
<bits/types.h
> directly (which is not allowed) and
382 overriding the __FD_SETSIZE macro. Beware, undocumented interfaces
383 can change at any time and without warning.
</p>
385 <p> But wait, there is more: none of this will work unless the
386 operating system is configured to handle thousands of connections.
387 See the
<a href=
"TUNING_README.html">TUNING_README
</a> guide for examples of how to increase the
388 number of open sockets or files.
</p>
390 <h3>4.6 - Compiling Postfix, at last
</h3>
392 <p> If the command
</p>
400 <p> is successful, then you can proceed to
<a href=
"#install">install
</a>
403 <p> If the command produces compiler error messages, it may be time
404 to search the web or to ask the postfix-users@postfix.org mailing
405 list, but be sure to search the mailing list archives first. Some
406 mailing list archives are linked from
<a href=
"http://www.postfix.org/">http://www.postfix.org/
</a>.
</p>
408 <h2> <a name=
"5">5 - Porting Postfix to an unsupported system
</a> </h2>
410 <p> Each system type that Postfix knows is identified by a unique
411 name. Examples: SUNOS5, FREEBSD4, and so on. When porting Postfix
412 to a new system, the first step is to choose a SYSTEMTYPE name for
413 the new system. You must use a name that includes at least the
414 major version of the operating system (such as SUNOS4 or LINUX2),
415 so that different releases of the same system can be supported
416 without confusion.
</p>
418 <p> Add a case statement to the
"makedefs" shell script in the
419 source code top-level directory that recognizes the new system
420 reliably, and that emits the right system-specific information.
421 Be sure to make the code robust against user PATH settings; if the
422 system offers multiple UNIX flavors (e.g. BSD and SYSV) be sure to
423 build for the native flavor, instead of the emulated one.
</p>
425 <p> Add an
"#ifdef SYSTEMTYPE" section to the central util/sys_defs.h
426 include file. You may have to invent new feature macro names.
427 Please choose sensible feature macro names such as HAS_DBM or
428 FIONREAD_IN_SYS_FILIO_H.
430 <p> I strongly recommend against using
"#ifdef SYSTEMTYPE" in
431 individual source files. While this may look like the quickest
432 solution, it will create a mess when newer versions of the same
433 SYSTEMTYPE need to be supported. You're likely to end up placing
434 "#ifdef" sections all over the source code again.
</p>
436 <h2><a name=
"install">6 - Installing the software after successful
439 <p> This text describes how to install Postfix from source code.
440 See the
<a href=
"PACKAGE_README.html">PACKAGE_README
</a> file if you are building a package for
441 distribution to other systems.
</p>
443 <h3>6.1 - Save existing Sendmail binaries
</h3>
445 <p> <a name=
"save">IMPORTANT
</a>: if you are REPLACING an existing
446 Sendmail installation with Postfix, you may need to keep the old
447 sendmail program running for some time in order to flush the mail
452 <li> <p> Some systems implement a mail switch mechanism where
453 different MTAs (Postfix, Sendmail, etc.) can be installed at the
454 same time, while only one of them is actually being used. Examples
455 of such switching mechanisms are the FreeBSD mailwrapper(
8) or the
456 Linux mail switch. In this case you should try to
"flip" the switch
457 to
"Postfix" before installing Postfix.
</p>
459 <li> <p> If your system has no mail switch mechanism, execute the
460 following commands (your sendmail, newaliases and mailq programs
461 may be in a different place):
</p>
464 # mv /usr/sbin/sendmail /usr/sbin/sendmail.OFF
465 # mv /usr/bin/newaliases /usr/bin/newaliases.OFF
466 # mv /usr/bin/mailq /usr/bin/mailq.OFF
467 # chmod
755 /usr/sbin/sendmail.OFF /usr/bin/newaliases.OFF \
473 <h3>6.2 - Create account and groups
</h3>
475 <p> Before you install Postfix for the first time you need to
476 create an account and a group:
</p>
480 <li> <p> Create a user account
"postfix" with a user id and group
481 id that are not used by any other user account. Preferably, this
482 is an account that no-one can log into. The account does not need
483 an executable login shell, and needs no existing home directory.
484 My password and group file entries look like this:
</p>
489 postfix:*:
12345:
12345:postfix:/no/where:/no/shell
496 <p> Note: there should be no whitespace before
"postfix:".
</p>
498 <li> <p> Create a group
"postdrop" with a group id that is not used
499 by any other user account. Not even by the postfix user account.
500 My group file entry looks like:
509 <p> Note: there should be no whitespace before
"postdrop:".
</p>
513 <h3>6.3 - Install Postfix
</h3>
515 <p> To install or upgrade Postfix from compiled source code, run
516 one of the following commands as the super-user:
</p>
520 # make install (interactive version, first time install)
522 # make upgrade (non-interactive version, for upgrades)
528 <li> <p> The interactive version (
"make install") asks for pathnames
529 for Postfix data and program files, and stores your preferences in
530 the
<a href=
"postconf.5.html">main.cf
</a> file.
<b> If you don't want Postfix to overwrite
531 non-Postfix
"sendmail",
"mailq" and
"newaliases" files, specify
532 pathnames that end in
".postfix"</b>.
</p>
534 <li> <p> The non-interactive version (
"make upgrade") needs the
535 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a> file from a previous installation. If the file
536 does not exist, use interactive installation (
"make install")
541 <h3>6.4 - Configure Postfix
</h3>
543 <p> Proceed to the section on how you wish to run Postfix on
544 your particular machine:
</p>
548 <li> <p> <a href=
"#send_only">Send
</a> mail only, without changing
549 an existing Sendmail installation (section
7).
</p>
551 <li> <p> <a href=
"#send_receive">Send and receive
</a> mail via a
552 virtual host interface, still without any change to an existing
553 Sendmail installation (section
8).
</p>
555 <li> <p> Run Postfix
<a href=
"#replace">instead of
</a> Sendmail
560 <h2><a name=
"send_only">7 - Configuring Postfix to send mail
563 <p> If you are going to use Postfix to send mail only, there is no
564 need to change your existing sendmail setup. Instead, set up your
565 mail user agent so that it calls the Postfix sendmail program
568 <p> Follow the instructions in the
"<a href="#mandatory
">Mandatory
569 configuration file edits</a>" in section
10, and review the
"<a
570 href="#hamlet
">To chroot or not to chroot</a>" text in section
573 <p> You MUST comment out the
"smtp inet" entry in /etc/postfix/
<a href=
"master.5.html">master.cf
</a>,
574 in order to avoid conflicts with the real sendmail. Put a
"#"
575 character in front of the line that defines the smtpd service:
</p>
579 /etc/postfix/
<a href=
"master.5.html">master.cf
</a>:
580 #smtp inet n - n - - smtpd
584 <p> Start the Postfix system:
</p>
592 <p> or, if you feel nostalgic, use the Postfix sendmail command:
</p>
596 # sendmail -bd -qwhatever
600 <p> and watch your maillog file for any error messages. The pathname
601 is /var/log/maillog, /var/log/mail, /var/log/syslog, or something
602 else. Typically, the pathname is defined in the /etc/syslog.conf
607 % egrep '(reject|warning|error|fatal|panic):' /some/log/file
611 <p> Note: the most important error message is logged first. Later
612 messages are not as useful.
</p>
614 <p> In order to inspect the mail queue, use one of the following
627 <p> See also the
"<a href="#care
">Care and feeding</a>" section
12
630 <h2><a name=
"send_receive">8 - Configuring Postfix to send and
631 receive mail via virtual interface
</a></h2>
633 <p> Alternatively, you can use the Postfix system to send AND
634 receive mail while leaving your Sendmail setup intact, by running
635 Postfix on a virtual interface address. Simply configure your mail
636 user agent to directly invoke the Postfix sendmail program.
</p>
638 <p> To create a virtual network interface address, study your
639 system ifconfig manual page. The command syntax could be any
644 #
<b>ifconfig le0:
1 <address
> netmask
<mask
> up
</b>
645 #
<b>ifconfig en0 alias
<address
> netmask
255.255.255.255</b>
649 <p> In the /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a> file, I would specify
</p>
653 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
654 <a href=
"postconf.5.html#myhostname">myhostname
</a> = virtual.host.tld
655 <a href=
"postconf.5.html#inet_interfaces">inet_interfaces
</a> = $
<a href=
"postconf.5.html#myhostname">myhostname
</a>
656 <a href=
"postconf.5.html#mydestination">mydestination
</a> = $
<a href=
"postconf.5.html#myhostname">myhostname
</a>
660 <p> Follow the instructions in the
"<a href="#mandatory
">Mandatory
661 configuration file edits</a>" in section
10, and review the
"<a
662 name="#hamlet
">To chroot or not to chroot</a>" text in section
665 <p> Start the Postfix system:
</p>
673 <p> or, if you feel nostalgic, use the Postfix sendmail command:
</p>
677 # sendmail -bd -qwhatever
681 <p> and watch your maillog file for any error messages. The pathname
682 is /var/log/maillog, /var/log/mail, /var/log/syslog, or something
683 else. Typically, the pathname is defined in the /etc/syslog.conf
688 % egrep '(reject|warning|error|fatal|panic):' /some/log/file
692 <p> Note: the most important error message is logged first. Later
693 messages are not as useful.
</p>
695 <p> In order to inspect the mail queue, use one of the following
708 <p> See also the
"<a href="#care
">Care and feeding</a>" section
12
711 <h2><a name=
"replace">9 - Running Postfix instead of Sendmail
</a></h2>
713 <p> Prior to installing Postfix you should
<a href=
"#save">save
</a>
714 any existing sendmail program files as described in section
6. Be
715 sure to keep the old sendmail running for at least a couple days
716 to flush any unsent mail. To do so, stop the sendmail daemon and
721 # /usr/sbin/sendmail.OFF -q
725 <p> Note: this is old sendmail syntax. Newer versions use separate
726 processes for mail submission and for running the queue.
</p>
728 <p> After you have visited the
"<a href="#mandatory
">Mandatory
729 configuration file edits</a>" section below, you can start the
730 Postfix system with:
</p>
738 <p> or, if you feel nostalgic, use the Postfix sendmail command:
</p>
742 # sendmail -bd -qwhatever
746 <p> and watch your maillog file for any error messages. The pathname
747 is /var/log/maillog, /var/log/mail, /var/log/syslog, or something
748 else. Typically, the pathname is defined in the /etc/syslog.conf
753 % egrep '(reject|warning|error|fatal|panic):' /some/log/file
757 <p> Note: the most important error message is logged first. Later
758 messages are not as useful.
</p>
760 <p> In order to inspect the mail queue, use one of the following
773 <p> See also the
"<a href="#care
">Care and feeding</a>" section
12
776 <h2><a name=
"mandatory">10 - Mandatory configuration file edits
</a></h2>
778 <p> Note: the material covered in this section is covered in more
779 detail in the
<a href=
"BASIC_CONFIGURATION_README.html">BASIC_CONFIGURATION_README
</a> document. The information
780 presented below is targeted at experienced system administrators.
783 <h3>10.1 - Postfix configuration files
</h3>
785 <p> By default, Postfix configuration files are in /etc/postfix.
786 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
787 must be owned by root. Giving someone else write permission to
788 <a href=
"postconf.5.html">main.cf
</a> or
<a href=
"master.5.html">master.cf
</a> (or to their parent directories) means giving
789 root privileges to that person.
</p>
791 <p> In /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>, you will have to set up a minimal number
792 of configuration parameters. Postfix configuration parameters
793 resemble shell variables, with two important differences: the first
794 one is that Postfix does not know about quotes like the UNIX shell
797 <p> You specify a configuration parameter as:
</p>
801 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
806 <p> and you use it by putting a
"$" character in front of its name:
</p>
810 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
811 other_parameter = $parameter
815 <p> You can use $parameter before it is given a value (that is the
816 second main difference with UNIX shell variables). The Postfix
817 configuration language uses lazy evaluation, and does not look at
818 a parameter value until it is needed at runtime.
</p>
820 <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,
821 execute the following command in order to refresh a running mail
830 <h3>10.2 - Default domain for unqualified addresses
</h3>
832 <p> First of all, you must specify what domain will be appended to an
833 unqualified address (i.e. an address without @domain.tld). The
834 "<a href="postconf
.5.html#myorigin
">myorigin</a>" parameter defaults to the local hostname, but that is
835 probably OK only for very small sites.
</p>
837 <p> Some examples (use only one):
</p>
841 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
842 <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>")
843 <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>")
847 <h3>10.3 - What domains to receive locally
</h3>
849 <p> Next you need to specify what mail addresses Postfix should deliver
852 <p> Some examples (use only one):
</p>
856 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
857 <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
858 <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>
859 <a href=
"postconf.5.html#mydestination">mydestination
</a> = $
<a href=
"postconf.5.html#myhostname">myhostname
</a>
863 <p>The first example is appropriate for a workstation, the second
864 is appropriate for the mailserver for an entire domain. The third
865 example should be used when running on a virtual host interface.
</p>
867 <h3>10.4 - Proxy/NAT interface addresses
</h3>
869 <p> The
<a href=
"postconf.5.html#proxy_interfaces">proxy_interfaces
</a> parameter specifies all network addresses
870 that Postfix receives mail on by way of a proxy or network address
871 translation unit. You may specify symbolic hostnames instead of
872 network addresses.
</p>
874 <p> IMPORTANT: You must specify your proxy/NAT external addresses
875 when your system is a backup MX host for other domains, otherwise
876 mail delivery loops will happen when the primary MX host is down.
879 <p> Example: host behind NAT box running a backup MX host.
</p>
883 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
884 <a href=
"postconf.5.html#proxy_interfaces">proxy_interfaces
</a> =
1.2.3.4 (the proxy/NAT external network address)
888 <h3>10.5 - What local clients to relay mail from
</h3>
890 <p> If your machine is on an open network then you must specify
891 what client IP addresses are authorized to relay their mail through
892 your machine into the Internet. The default setting includes all
893 subnetworks that the machine is attached to. This may give relay
894 permission to too many clients. My own settings are:
</p>
898 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
899 <a href=
"postconf.5.html#mynetworks">mynetworks
</a> =
168.100.189.0/
28,
127.0.0.0/
8
903 <h3>10.6 - What relay destinations to accept from strangers
</h3>
905 <p> If your machine is on an open network then you must also specify
906 whether Postfix will forward mail from strangers. The default
907 setting will forward mail to all domains (and subdomains of) what
908 is listed in $
<a href=
"postconf.5.html#mydestination">mydestination
</a>. This may give relay permission for
909 too many destinations. Recommended settings (use only one):
</p>
913 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
914 <a href=
"postconf.5.html#relay_domains">relay_domains
</a> = (do not forward mail from strangers)
915 <a href=
"postconf.5.html#relay_domains">relay_domains
</a> = $
<a href=
"postconf.5.html#mydomain">mydomain
</a> (my domain and subdomains)
916 <a href=
"postconf.5.html#relay_domains">relay_domains
</a> = $
<a href=
"postconf.5.html#mydomain">mydomain
</a>, other.domain.tld, ...
920 <h3>10.7 - Optional: configure a smart host for remote delivery
</h3>
922 <p> If you're behind a firewall, you should set up a
<a href=
"postconf.5.html#relayhost">relayhost
</a>. If
923 you can, specify the organizational domain name so that Postfix
924 can use DNS lookups, and so that it can fall back to a secondary
925 MX host when the primary MX host is down. Otherwise just specify
926 a hard-coded hostname.
</p>
928 <p> Some examples (use only one):
</p>
932 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
933 <a href=
"postconf.5.html#relayhost">relayhost
</a> = $
<a href=
"postconf.5.html#mydomain">mydomain
</a>
934 <a href=
"postconf.5.html#relayhost">relayhost
</a> = [mail.$
<a href=
"postconf.5.html#mydomain">mydomain
</a>]
938 <p> The form enclosed with
<tt>[]
</tt> eliminates DNS MX lookups.
</p>
940 <p> By default, the SMTP client will do DNS lookups even when you
941 specify a
<a href=
"postconf.5.html#relayhost">relay host
</a>. If your machine has no access to a DNS server,
942 turn off SMTP client DNS lookups like this:
</p>
946 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
947 <a href=
"postconf.5.html#disable_dns_lookups">disable_dns_lookups
</a> = yes
951 <p> The
<a href=
"STANDARD_CONFIGURATION_README.html">STANDARD_CONFIGURATION_README
</a> file has more hints and tips for
952 firewalled and/or dial-up networks.
</p>
954 <h3>10.8 - Create the aliases database
</h3>
956 <p> Postfix uses a Sendmail-compatible
<a href=
"aliases.5.html">aliases(
5)
</a> table to redirect
957 mail for
<a href=
"local.8.html">local(
8)
</a> recipients. Typically, this information is kept
958 in two files: in a text file /etc/aliases and in an indexed file
959 /etc/aliases.db. The command
"postconf <a href="postconf
.5.html#alias_maps
">alias_maps</a>" will tell you
960 the exact location of the text file.
</p>
962 <p> First, be sure to update the text file with aliases for root,
963 postmaster and
"postfix" that forward mail to a real person. Postfix
964 has a sample aliases file /etc/postfix/aliases that you can adapt
965 to local conditions.
</p>
978 <p> Note: there should be no whitespace before the
":".
</p>
980 <p> Finally, build the indexed aliases file with one of the
981 following commands:
</p>
990 <h2><a name=
"hamlet">11 - To chroot or not to chroot
</a></h2>
992 <p> Postfix daemon processes can be configured (via
<a href=
"master.5.html">master.cf
</a>) to
993 run in a chroot jail. The processes run at a fixed low privilege
994 and with access only to the Postfix queue directories (/var/spool/postfix).
995 This provides a significant barrier against intrusion. The barrier
996 is not impenetrable, but every little bit helps.
</p>
998 <p> With the exception of Postfix daemons that deliver mail locally
999 and/or that execute non-Postfix commands, every Postfix daemon can
1002 <p> Sites with high security requirements should consider to chroot
1003 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>
1004 processes, and perhaps also the
<a href=
"lmtp.8.html">lmtp(
8)
</a> client. The author's own
1005 porcupine.org mail server runs all daemons chrooted that can be
1008 <p> The default /etc/postfix/
<a href=
"master.5.html">master.cf
</a> file specifies that no
1009 Postfix daemon runs chrooted. In order to enable chroot operation,
1010 edit the file /etc/postfix/
<a href=
"master.5.html">master.cf
</a>. Instructions are in the file.
1013 <p> Note that a chrooted daemon resolves all filenames relative to
1014 the Postfix queue directory (/var/spool/postfix). For successful
1015 use of a chroot jail, most UNIX systems require you to bring in
1016 some files or device nodes. The examples/chroot-setup directory
1017 in the source code distribution has a collection of scripts that
1018 help you set up Postfix chroot environments on different operating
1021 <p> Additionally, you almost certainly need to configure syslogd
1022 so that it listens on a socket inside the Postfix queue directory.
1023 Examples for specific systems:
</p>
1030 # mkdir -p /var/spool/postfix/var/run
1031 # syslogd -l /var/spool/postfix/var/run/log
1034 <dt> Linux, OpenBSD:
</dt>
1037 # mkdir -p /var/spool/postfix/dev
1038 # syslogd -a /var/spool/postfix/dev/log
1043 <h2><a name=
"care">12 - Care and feeding of the Postfix system
</a></h2>
1045 <p> Postfix daemon processes run in the background, and log problems
1046 and normal activity to the syslog daemon. The names of logfiles
1047 are specified in /etc/syslog.conf. At the very least you need
1048 something like:
</p>
1053 mail.err /dev/console
1054 mail.debug /var/log/maillog
1058 <p> IMPORTANT: the syslogd will not create files. You must create
1059 them before (re)starting syslogd.
</p>
1061 <p> IMPORTANT: on Linux you need to put a
"-" character before
1062 the pathname, e.g., -/var/log/maillog, otherwise the syslogd
1063 will use more system resources than Postfix does.
</p>
1065 <p> Hopefully, the number of problems will be small, but it is a good
1066 idea to run every night before the syslog files are rotated:
</p>
1071 # egrep '(reject|warning|error|fatal|panic):' /some/log/file
1077 <li> <p> The first line (postfix check) causes Postfix to report
1078 file permission/ownership discrepancies.
</p>
1080 <li> <p> The second line looks for problem reports from the mail
1081 software, and reports how effective the relay and junk mail access
1082 blocks are. This may produce a lot of output. You will want to
1083 apply some postprocessing to eliminate uninteresting information.
1088 <p> The
<a href=
"DEBUG_README.html#logging"> DEBUG_README
</a>
1089 document describes the meaning of the
"warning" etc. labels in
1090 Postfix logging.
</p>