1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
|
PPoossttffiixx IInnssttaallllaattiioonn FFrroomm SSoouurrccee CCooddee
-------------------------------------------------------------------------------
11 -- PPuurrppoossee ooff tthhiiss ddooccuummeenntt
This is a bootstrap document that helps you get Postfix up and running from
scratch with the minimal number of steps. If you are using a pre-compiled
version of Postfix, you should be reading the general Postfix documentation
which aims to describe the system in more detail. This bootstrap document
should not be considered part of the general Postfix documentation.
This document describes how to build, install and configure a Postfix system so
that it can do one of the following:
* Send mail only, without changing an existing Sendmail installation.
* Send and receive mail via a virtual host interface, still without any
change to an existing Sendmail installation.
* Run Postfix instead of Sendmail.
Topics covered in this document:
1. Purpose of this document
2. Typographical conventions
3. Documentation
4. Building on a supported system
5. Porting Postfix to an unsupported system
6. Installing the software after successful compilation
7. Configuring Postfix to send mail only
8. Configuring Postfix to send and receive mail via virtual interface
9. Running Postfix instead of Sendmail
10. Mandatory configuration file edits
11. To chroot or not to chroot
12. Care and feeding of the Postfix system
22 -- TTyyppooggrraapphhiiccaall ccoonnvveennttiioonnss
In the instructions below, a command written as
# command
should be executed as the superuser.
A command written as
% command
should be executed as an unprivileged user.
33 -- DDooccuummeennttaattiioonn
Documentation is available as README files (start with the file README_FILES/
AAAREADME), as HTML web pages (point your browser to "html/index.html") and as
UNIX-style manual pages.
You should view the README files with a pager such as more(1) or less(1),
because the files use backspace characters in order to produce bboolldd font. To
print a README file without backspace characters, use the col(1) command. For
example:
% col -bx <file | lpr
In order to view the manual pages before installing Postfix, point your MANPATH
environment variable to the "man" subdirectory; be sure to use an absolute
path.
% export MANPATH; MANPATH="`pwd`/man:$MANPATH"
% setenv MANPATH "`pwd`/man:$MANPATH"
Of particular interest is the postconf(5) manual page that lists all the 400+
configuration parameters. The HTML version of this text makes it easy to
navigate around.
All Postfix source files have their own built-in manual page. Tools to extract
those embedded manual pages are available in the mantools directory.
44 -- BBuuiillddiinngg oonn aa ssuuppppoorrtteedd ssyysstteemm
At some point in time, a version of Postfix was supported on:
AIX 3.2.5, 4.1.x, 4.2.0, 4.3.x, 5.2
BSD/OS 2.x, 3.x, 4.x
Darwin 1.x
FreeBSD 2.x, 3.x, 4.x, 5.x
HP-UX 9.x, 10.x, 11.x
IRIX 5.x, 6.x
Linux Debian 1.3.1, 2.x, 3.x
Linux RedHat 3.x (January 2004) - 9.x
Linux Slackware 3.x, 4.x, 7.x
Linux SuSE 5.x, 6.x, 7.x
Mac OS X
NEXTSTEP 3.x
NetBSD 1.x
OPENSTEP 4.x
OSF1.V3 - OSF1.V5 (Digital UNIX)
Reliant UNIX 5.x
Rhapsody 5.x
SunOS 4.1.4 (July 2006)
SunOS 5.4 - 5.9 (Solaris 2.4..9)
Ultrix 4.x (well, that was long ago)
or something closely resemblant.
44..11 -- GGeettttiinngg ssttaarrtteedd
On Solaris, the "make" command and other utilities for software development are
in /usr/ccs/bin, so you MUST have /usr/ccs/bin in your command search path.
If you need to build Postfix for multiple architectures, use the "lndir"
command to build a shadow tree with symbolic links to the source files. "lndir"
is part of X11R6.
If at any time in the build process you get messages like: "make: don't know
how to ..." you should be able to recover by running the following command from
the Postfix top-level directory:
% make -f Makefile.init makefiles
If you copied the Postfix source code after building it on another machine, it
is a good idea to cd into the top-level directory and first do this:
% make tidy
This will get rid of any system dependencies left over from compiling the
software elsewhere.
44..22 -- WWhhaatt ccoommppiilleerr ttoo uussee
To build with GCC, or with the native compiler if people told me that is better
for your system, just cd into the top-level Postfix directory of the source
tree and type:
% make
To build with a non-default compiler, you need to specify the name of the
compiler. Here are a few examples:
% make makefiles CC=/opt/SUNWspro/bin/cc (Solaris)
% make
% make makefiles CC="/opt/ansic/bin/cc -Ae" (HP-UX)
% make
% make makefiles CC="purify cc"
% make
and so on. In some cases, optimization is turned off automatically.
44..33 -- BBuuiillddiinngg wwiitthh ooppttiioonnaall eexxtteennssiioonnss
By default, Postfix builds as a mail system with relatively few bells and
whistles. Support for third-party databases etc. must be configured when
Postfix is compiled. The following documents describe how to build Postfix with
support for extensions:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|PPoossttffiixx eexxtteennssiioonn |DDooccuummeenntt |AAvvaaiillaabbiilliittyy|
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|Berkeley DB database |DB_README |Postfix 1.0 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|LDAP database |LDAP_README |Postfix 1.0 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|MySQL database |MYSQL_README|Postfix 1.0 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|Perl compatible regular expression|PCRE_README |Postfix 1.0 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|PostgreSQL database |PGSQL_README|Postfix 2.0 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|SASL authentication |SASL_README |Postfix 1.0 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
|STARTTLS session encryption |TLS_README |Postfix 2.2 |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ |
Note: IP version 6 support is compiled into Postfix on operating systems that
have IPv6 support. See the IPV6_README file for details.
44..44 -- OOvveerrrriiddiinngg bbuuiilltt--iinn ppaarraammeetteerr ddeeffaauulltt sseettttiinnggss
All Postfix configuration parameters can be changed by editing a Postfix
configuration file, except for one: the parameter that specifies the location
of Postfix configuration files. In order to build Postfix with a configuration
directory other than /etc/postfix, use:
% make makefiles CCARGS='-DDEF_CONFIG_DIR=\"/some/where\"'
% make
IMPORTANT: Be sure to get the quotes right. These details matter a lot.
Parameters whose defaults can be specified in this way are:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|MMaaccrroo nnaammee |ddeeffaauulltt vvaalluuee ffoorr|ttyyppiiccaall ddeeffaauulltt |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_COMMAND_DIR |command_directory|/usr/sbin |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_CONFIG_DIR |config_directory |/etc/postfix |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_DAEMON_DIR |daemon_directory |/usr/libexec/postfix|
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_MAILQ_PATH |mailq_path |/usr/bin/mailq |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_HTML_DIR |html_directory |no |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_MANPAGE_DIR |manpage_directory|/usr/local/man |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_NEWALIAS_PATH|newaliases_path |/usr/bin/newaliases |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_QUEUE_DIR |queue_directory |/var/spool/postfix |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_README_DIR |readme_directory |no |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
|DEF_SENDMAIL_PATH|sendmail_path |/usr/sbin/sendmail |
|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _|_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ |
44..55 -- SSuuppppoorrtt ffoorr tthhoouussaannddss ooff pprroocceesssseess
In order to build Postfix for very large applications, where you expect to run
more than 1000 mail delivery processes, you may need to override the definition
of the FD_SETSIZE macro to make select() work correctly:
% make makefiles CCARGS=-DFD_SETSIZE=2048
Warning: the above has no effect on some Linux versions. Apparently, on these
systems the FD_SETSIZE value can be changed only by using undocumented
interfaces. Currently, that means including <bits/types.h> directly (which is
not allowed) and overriding the __FD_SETSIZE macro. Beware, undocumented
interfaces can change at any time and without warning.
44..66 -- CCoommppiilliinngg PPoossttffiixx,, aatt llaasstt
If the command
% make
is successful, then you can proceed to install Postfix (section 6).
If the command produces compiler error messages, it may be time to search the
web or to ask the postfix-users@postfix.org mailing list, but be sure to search
the mailing list archives first. Some mailing list archives are linked from
http://www.postfix.org/.
55 -- PPoorrttiinngg PPoossttffiixx ttoo aann uunnssuuppppoorrtteedd ssyysstteemm
Each system type that Postfix knows is identified by a unique name. Examples:
SUNOS5, FREEBSD4, and so on. When porting Postfix to a new system, the first
step is to choose a SYSTEMTYPE name for the new system. You must use a name
that includes at least the major version of the operating system (such as
SUNOS4 or LINUX2), so that different releases of the same system can be
supported without confusion.
Add a case statement to the "makedefs" shell script in the source code top-
level directory that recognizes the new system reliably, and that emits the
right system-specific information. Be sure to make the code robust against user
PATH settings; if the system offers multiple UNIX flavors (e.g. BSD and SYSV)
be sure to build for the native flavor, instead of the emulated one.
Add an "#ifdef SYSTEMTYPE" section to the central util/sys_defs.h include file.
You may have to invent new feature macro names. Please choose sensible feature
macro names such as HAS_DBM or FIONREAD_IN_SYS_FILIO_H.
I strongly recommend against using "#ifdef SYSTEMTYPE" in individual source
files. While this may look like the quickest solution, it will create a mess
when newer versions of the same SYSTEMTYPE need to be supported. You're likely
to end up placing "#ifdef" sections all over the source code again.
66 -- IInnssttaalllliinngg tthhee ssooffttwwaarree aafftteerr ssuucccceessssffuull ccoommppiillaattiioonn
This text describes how to install Postfix from source code. See the
PACKAGE_README file if you are building a package for distribution to other
systems. See auxiliary/MacOSX/README-INSTALL.OSX for information about
installing Postfix from source on Mac OS X.
66..11 -- SSaavvee eexxiissttiinngg SSeennddmmaaiill bbiinnaarriieess
IMPORTANT: if you are REPLACING an existing Sendmail installation with Postfix,
you may need to keep the old sendmail program running for some time in order to
flush the mail queue. As superuser, execute the following commands (your
sendmail, newaliases and mailq programs may be in a different place):
# mv /usr/sbin/sendmail /usr/sbin/sendmail.OFF
# mv /usr/bin/newaliases /usr/bin/newaliases.OFF
# mv /usr/bin/mailq /usr/bin/mailq.OFF
# chmod 755 /usr/sbin/sendmail.OFF /usr/bin/newaliases.OFF \
/usr/bin/mailq.OFF
66..22 -- CCrreeaattee aaccccoouunntt aanndd ggrroouuppss
Before you install Postfix for the first time you need to create an account and
a group:
* Create a user account "postfix" with a user id and group id that are not
used by any other user account. Preferably, this is an account that no-one
can log into. The account does not need an executable login shell, and
needs no existing home directory. My password and group file entries look
like this:
/etc/passwd:
postfix:*:12345:12345:postfix:/no/where:/no/shell
/etc/group:
postfix:*:12345:
Note: there should be no whitespace before "postfix:".
* Create a group "postdrop" with a group id that is not used by any other
user account. Not even by the postfix user account. My group file entry
looks like:
/etc/group:
postdrop:*:54321:
Note: there should be no whitespace before "postdrop:".
66..33 -- IInnssttaallll PPoossttffiixx
To install or upgrade Postfix from compiled source code, run one of the
following commands as the super-user:
# make install (interactive version, first time install)
# make upgrade (non-interactive version, for upgrades)
* The non-interactive version ("make upgrade") needs the /etc/postfix/main.cf
file from a previous installation. If the file does not exist, use
interactive installation ("make install") instead.
* The interactive version offers suggestions for pathnames that you can
override interactively, and stores your preferences in /etc/postfix/main.cf
for convenient future upgrades.
66..44 -- CCoonnffiigguurree PPoossttffiixx
Proceed to the section on how you wish to run Postfix on your particular
machine:
* Send mail only, without changing an existing Sendmail installation (section
7).
* Send and receive mail via a virtual host interface, still without any
change to an existing Sendmail installation (section 8).
* Run Postfix instead of Sendmail (section 9).
77 -- CCoonnffiigguurriinngg PPoossttffiixx ttoo sseenndd mmaaiill oonnllyy
If you are going to use Postfix to send mail only, there is no need to change
your existing sendmail setup. Instead, set up your mail user agent so that it
calls the Postfix sendmail program directly.
Follow the instructions in the "Mandatory configuration file edits" in section
10, and review the "To chroot or not to chroot" text in section 11.
You MUST comment out the "smtp inet" entry in /etc/postfix/master.cf, in order
to avoid conflicts with the real sendmail. Put a "#" character in front of the
line that defines the smtpd service:
/etc/postfix/master.cf:
#smtp inet n - n - - smtpd
Start the Postfix system:
# postfix start
or, if you feel nostalgic, use the Postfix sendmail command:
# sendmail -bd -qwhatever
and watch your maillog file for any error messages. The pathname is /var/log/
maillog, /var/log/mail, /var/log/syslog, or something else. Typically, the
pathname is defined in the /etc/syslog.conf file.
% egrep '(reject|warning|error|fatal|panic):' /some/log/file
Note: the most important error message is logged first. Later messages are not
as useful.
In order to inspect the mail queue, use one of the following commands:
% mailq
% sendmail -bp
% postqueue -p
See also the "Care and feeding" section 12 below.
88 -- CCoonnffiigguurriinngg PPoossttffiixx ttoo sseenndd aanndd rreecceeiivvee mmaaiill vviiaa vviirrttuuaall iinntteerrffaaccee
Alternatively, you can use the Postfix system to send AND receive mail while
leaving your Sendmail setup intact, by running Postfix on a virtual interface
address. Simply configure your mail user agent to directly invoke the Postfix
sendmail program.
In the /etc/postfix/main.cf file, I would specify
/etc/postfix/main.cf:
myhostname = virtual.host.tld
inet_interfaces = $myhostname
mydestination = $myhostname
Follow the instructions in the "Mandatory configuration file edits" in section
10, and review the "To chroot or not to chroot" text in section 11.
Start the Postfix system:
# postfix start
or, if you feel nostalgic, use the Postfix sendmail command:
# sendmail -bd -qwhatever
and watch your maillog file for any error messages. The pathname is /var/log/
maillog, /var/log/mail, /var/log/syslog, or something else. Typically, the
pathname is defined in the /etc/syslog.conf file.
% egrep '(reject|warning|error|fatal|panic):' /some/log/file
Note: the most important error message is logged first. Later messages are not
as useful.
In order to inspect the mail queue, use one of the following commands:
% mailq
% sendmail -bp
% postqueue -p
See also the "Care and feeding" section 12 below.
99 -- RRuunnnniinngg PPoossttffiixx iinnsstteeaadd ooff SSeennddmmaaiill
Prior to installing Postfix you should save any existing sendmail program files
as described in section 6. Be sure to keep the old sendmail running for at
least a couple days to flush any unsent mail. To do so, stop the sendmail
daemon and restart it as:
# /usr/sbin/sendmail.OFF -q
Note: this is old sendmail syntax. Newer versions use separate processes for
mail submission and for running the queue.
After you have visited the "Mandatory configuration file edits" section below,
you can start the Postfix system with:
# postfix start
or, if you feel nostalgic, use the Postfix sendmail command:
# sendmail -bd -qwhatever
and watch your maillog file for any error messages. The pathname is /var/log/
maillog, /var/log/mail, /var/log/syslog, or someting else. Typically, the
pathname is defined in the /etc/syslog.conf file.
% egrep '(reject|warning|error|fatal|panic):' /some/log/file
Note: the most important error message is logged first. Later messages are not
as useful.
In order to inspect the mail queue, use one of the following commands:
% mailq
% sendmail -bp
% postqueue -p
See also the "Care and feeding" section 12 below.
1100 -- MMaannddaattoorryy ccoonnffiigguurraattiioonn ffiillee eeddiittss
Note: the material covered in this section is covered in more detail in the
BASIC_CONFIGURATION_README document. The information presented below is
targeted at experienced system administrators.
1100..11 -- PPoossttffiixx ccoonnffiigguurraattiioonn ffiilleess
By default, Postfix configuration files are in /etc/postfix. The two most
important files are main.cf and master.cf; these files must be owned by root.
Giving someone else write permission to main.cf or master.cf (or to their
parent directories) means giving root privileges to that person.
In /etc/postfix/main.cf, you will have to set up a minimal number of
configuration parameters. Postfix configuration parameters resemble shell
variables, with two important differences: the first one is that Postfix does
not know about quotes like the UNIX shell does.
You specify a configuration parameter as:
/etc/postfix/main.cf:
parameter = value
and you use it by putting a "$" character in front of its name:
/etc/postfix/main.cf:
other_parameter = $parameter
You can use $parameter before it is given a value (that is the second main
difference with UNIX shell variables). The Postfix configuration language uses
lazy evaluation, and does not look at a parameter value until it is needed at
runtime.
Whenever you make a change to the main.cf or master.cf file, execute the
following command in order to refresh a running mail system:
# postfix reload
1100..22 -- DDeeffaauulltt ddoommaaiinn ffoorr uunnqquuaalliiffiieedd aaddddrreesssseess
First of all, you must specify what domain will be appended to an unqualified
address (i.e. an address without @domain.tld). The "myorigin" parameter
defaults to the local hostname, but that is probably OK only for very small
sites.
Some examples (use only one):
/etc/postfix/main.cf:
myorigin = $myhostname (send mail as "user@$myhostname")
myorigin = $mydomain (send mail as "user@$mydomain")
1100..33 -- WWhhaatt ddoommaaiinnss ttoo rreecceeiivvee llooccaallllyy
Next you need to specify what mail addresses Postfix should deliver locally.
Some examples (use only one):
/etc/postfix/main.cf:
mydestination = $myhostname, localhost.$mydomain, localhost
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydestination = $myhostname
The first example is appropriate for a workstation, the second is appropriate
for the mailserver for an entire domain. The third example should be used when
running on a virtual host interface.
1100..44 -- PPrrooxxyy//NNAATT iinntteerrffaaccee aaddddrreesssseess
The proxy_interfaces parameter specifies all network addresses that Postfix
receives mail on by way of a proxy or network address translation unit. You may
specify symbolic hostnames instead of network addresses.
IMPORTANT: You must specify your proxy/NAT external addresses when your system
is a backup MX host for other domains, otherwise mail delivery loops will
happen when the primary MX host is down.
Example: host behind NAT box running a backup MX host.
/etc/postfix/main.cf:
proxy_interfaces = 1.2.3.4 (the proxy/NAT external network address)
1100..55 -- WWhhaatt llooccaall cclliieennttss ttoo rreellaayy mmaaiill ffrroomm
If your machine is on an open network then you must specify what client IP
addresses are authorized to relay their mail through your machine into the
Internet. The default setting includes all subnetworks that the machine is
attached to. This may give relay permission to too many clients. My own
settings are:
/etc/postfix/main.cf:
mynetworks = 168.100.189.0/28, 127.0.0.0/8
1100..66 -- WWhhaatt rreellaayy ddeessttiinnaattiioonnss ttoo aacccceepptt ffrroomm ssttrraannggeerrss
If your machine is on an open network then you must also specify whether
Postfix will forward mail from strangers. The default setting will forward mail
to all domains (and subdomains of) what is listed in $mydestination. This may
give relay permission for too many destinations. Recommended settings (use only
one):
/etc/postfix/main.cf:
relay_domains = (do not forward mail from strangers)
relay_domains = $mydomain (my domain and subdomains)
relay_domains = $mydomain, other.domain.tld, ...
1100..77 -- OOppttiioonnaall:: ccoonnffiigguurree aa ssmmaarrtt hhoosstt ffoorr rreemmoottee ddeelliivveerryy
If you're behind a firewall, you should set up a relayhost. If you can, specify
the organizational domain name so that Postfix can use DNS lookups, and so that
it can fall back to a secondary MX host when the primary MX host is down.
Otherwise just specify a hard-coded hostname.
Some examples (use only one):
/etc/postfix/main.cf:
relayhost = $mydomain
relayhost = [mail.$mydomain]
The form enclosed with [] eliminates DNS MX lookups.
By default, the SMTP client will do DNS lookups even when you specify a relay
host. If your machine has no access to a DNS server, turn off SMTP client DNS
lookups like this:
/etc/postfix/main.cf:
disable_dns_lookups = yes
The STANDARD_CONFIGURATION_README file has more hints and tips for firewalled
and/or dial-up networks.
1100..88 -- CCrreeaattee tthhee aalliiaasseess ddaattaabbaassee
Postfix uses a Sendmail-compatible aliases(5) table to redirect mail for local
(8) recipients. Typically, this information is kept in two files: in a text
file /etc/aliases and in an indexed file /etc/aliases.db. The command "postconf
alias_maps" will tell you the exact location of the text file.
First, be sure to update the text file with aliases for root, postmaster and
"postfix" that forward mail to a real person. Postfix has a sample aliases file
/etc/postfix/aliases that you can adapt to local conditions.
/etc/aliases:
root: you
postmaster: root
postfix: root
bin: root
etcetera...
Note: there should be no whitespace before the ":".
Finally, build the indexed aliases file with one of the following commands:
# newaliases
# sendmail -bi
1111 -- TToo cchhrroooott oorr nnoott ttoo cchhrroooott
Postfix daemon processes can be configured (via master.cf) to run in a chroot
jail. The processes run at a fixed low privilege and with access only to the
Postfix queue directories (/var/spool/postfix). This provides a significant
barrier against intrusion. The barrier is not impenetrable, but every little
bit helps.
With the exception of Postfix daemons that deliver mail locally and/or that
execute non-Postfix commands, every Postfix daemon can run chrooted.
Sites with high security requirements should consider to chroot all daemons
that talk to the network: the smtp(8) and smtpd(8) processes, and perhaps also
the lmtp(8) client. The author's own porcupine.org mail server runs all daemons
chrooted that can be chrooted.
The default /etc/postfix/master.cf file specifies that no Postfix daemon runs
chrooted. In order to enable chroot operation, edit the file /etc/postfix/
master.cf. Instructions are in the file.
Note that a chrooted daemon resolves all filenames relative to the Postfix
queue directory (/var/spool/postfix). For successful use of a chroot jail, most
UNIX systems require you to bring in some files or device nodes. The examples/
chroot-setup directory in the source code distribution has a collection of
scripts that help you set up Postfix chroot environments on different operating
systems.
Additionally, you almost certainly need to configure syslogd so that it listens
on a socket inside the Postfix queue directory. Examples for specific systems:
FreeBSD:
# mkdir -p /var/spool/postfix/var/run
# syslogd -l /var/spool/postfix/var/run/log
Linux, OpenBSD:
# mkdir -p /var/spool/postfix/dev
# syslogd -a /var/spool/postfix/dev/log
1122 -- CCaarree aanndd ffeeeeddiinngg ooff tthhee PPoossttffiixx ssyysstteemm
Postfix daemon processes run in the background, and log problems and normal
activity to the syslog daemon. The names of logfiles are specified in /etc/
syslog.conf. At the very least you need something like:
/etc/syslog.conf:
mail.err /dev/console
mail.debug /var/log/maillog
IMPORTANT: the syslogd will not create files. You must create them before
(re)starting syslogd.
IMPORTANT: on Linux you need to put a "-" character before the pathname, e.g.,
-/var/log/maillog, otherwise the syslogd will use more system resources than
Postfix does.
Hopefully, the number of problems will be small, but it is a good idea to run
every night before the syslog files are rotated:
# postfix check
# egrep '(reject|warning|error|fatal|panic):' /some/log/file
* The first line (postfix check) causes Postfix to report file permission/
ownership discrepancies.
* The second line looks for problem reports from the mail software, and
reports how effective the relay and junk mail access blocks are. This may
produce a lot of output. You will want to apply some postprocessing to
eliminate uninteresting information.
The DEBUG_README document describes the meaning of the "warning" etc. labels in
Postfix logging.
|