Installing Postfix

   

Postfix installation under Mac OS X is verging on trivial. The Postfix software includes several scripts for everything from backing up your sendmail installation to adding the necessary users to Netinfo. This is an excellent example of the open source community's embracing of Mac OS X.

Preparing the System

First, download the latest version Postfix from ftp://postfix.webweaver.net/official/postfix-1.1.8.tar.gz. Be sure that you find the "correct" latest version ”Postfix seems to have changed numbering sequences recently. At the time of this writing, 1.1.8 was the most recent.

Unarchive the software and cd into the software installation directory:

  % tar zxf postfix-1.1.8.tar.gz   % cd postfix-1.1.8/  

Next , you'll need to back up your existing sendmail installation in case you want or need to go back to the original software. The auxiliary/MacOSX directory contains a script called backup-sendmail-binaries , which, as its name suggests, does just that. You'll want to either su to root or use sudo to execute the rest of the installation:

  # cd auxiliary/MacOSX   # ./backup-sendmail-binaries  

NOTE

If you'd like to back up the sendmail binaries by hand, the files you want to copy are /usr/sbin/sendmail , /usr/bin/newaliases , and /usr/bin/mailq .

Now, it's time to add the users and groups necessary to run Postfix. There are two groups ( postfix and maildrop ) and a user account ( postfix ) that must be created before you install Postfix. The script niscript (also located in the auxiliary/MacOSX directory) will do it all for you.

  # ./niscript  This script massages your netinfo database.  This can severely break your system. If your netinfo database breaks, you get to keep the parts. No Warranty. Really. This script tries to create two groups (if they do not already exist): - postfix - maildrop and tries to create a user (if it does not already exist) - postfix which is member of group postfix. Will create postfix as gid 88 Will create maildrop as gid 89 Will create postfix as uid 88 

NOTE

The postfix and maildrop UID and GIDs are not hardcoded to 88 and 89 as shown in the example. The script automatically chooses unused numbers for you.

Finally, cd back into the main source distribution directory and compile the software with a simple make :

[View full width]
 
[View full width]
# cd ../.. # make make -f Makefile.in MAKELEVEL= Makefiles set -e; for i in src/util src/global src/dns src/master src/postfix src/smtpstone src/ graphics/ccc.gif sendmail src/error src/pickup src/cleanup src/smtpd src/local src/lmtp src/ graphics/ccc.gif trivial-rewrite src/qmgr src/smtp src/bounce src/pipe src/showq src/postalias src/postcat graphics/ccc.gif src/postconf src/postdrop src/postkick src/postlock src/postlog src/postmap src/postqueue graphics/ccc.gif src/postsuper src/nqmgr src/qmqpd src/spawn src/flush src/virtual; do \ (set -e; echo "[$i]"; cd $i; rm -f Makefile; \ make -f Makefile.in Makefile MAKELEVEL=) exit 1; \ done; [src/util] ... cc -g -O -I. -I../../include -DRHAPSODY5 -I.. -c unknown.c cc -g -O -I. -I../../include -DRHAPSODY5 -I.. -o virtual virtual.o mailbox.o recipient.o graphics/ccc.gif deliver_attr.o maildir.o unknown. o ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/ graphics/ccc.gif libutil.a -flat_namespace cp virtual ../../libexec

Basic Setup

After Postfix has successfully compiled, the next step is to run the install script. It prompts you for various settings (for most, the default answer will suffice). Type make install to run the install script (the output of which is summarized for the sake of brevity):

 #  make install  Please specify the prefix for installed file names. This is useful if you are building ready-to-install packages for distribution to other machines. install_root: [/] Please specify a directory for scratch files while installing Postfix. You must have write permission in this directory. tempdir: [/Users/jray/Desktop/book code/postfix-1.1.8]  /tmp  Please specify the destination directory for installed Postfix configuration files. config_directory: [/etc/postfix] Please specify the destination directory for installed Postfix daemon programs. This directory should not be in the command search path of any users. daemon_directory: [/usr/libexec/postfix] Please specify the destination directory for installed Postfix administrative commands. This directory should be in the command search path of adminstrative users. command_directory: [/usr/sbin] Please specify the destination directory for Postfix queues. queue_directory: [/var/spool/postfix] Please specify the full destination pathname for the installed Postfix sendmail command. This is the Sendmail-compatible mail posting interface. sendmail_path: [/usr/sbin/sendmail] Please specify the full destination pathname for the installed Postfix newaliases command. This is the Sendmail-compatible command to build alias databases for the Postfix local delivery agent. newaliases_path: [/usr/bin/newaliases] Please specify the full destination pathname for the installed Postfix mailq command. This is the Sendmail-compatible mail queue listing command. mailq_path: [/usr/bin/mailq] Please specify the owner of the Postfix queue. Specify an account with numerical user ID and group ID values that are not used by any other accounts on the system. mail_owner: [postfix] Please specify the group for mail submission and for queue management commands. Specify a group name with a numerical group ID that is not shared with other accounts, not even with the Postfix mail_owner account. You can no longer specify "no" here. setgid_group: [postdrop]  maildrop  Please specify the destination directory for the Postfix on-line manual pages. You can no longer specify "no" here. manpage_directory: [/usr/local/man] Please specify the destination directory for the Postfix sample configuration files. sample_directory: [/etc/postfix] Please specify the destination directory for the Postfix README files. Specify "no" if you do not want to install these files. readme_directory: [no]  /etc/postfix/readme  ...     Warning: you still need to edit myorigin/mydestination/mynetworks     parameter settings in /etc/postfix/main.cf.     See also http://www.postfix.org/faq.html for information about     dialup sites or about sites inside a firewalled network.     BTW: Check your /etc/aliases file and be sure to set up aliases     that send mail for root and postmaster to a real person, then     run /usr/bin/newaliases. 

After the install has completed, you should create an archive of the Postfix installation. This will enable you to swap Postfix/sendmail at will by using the included Postfix scripts. Change back into the auxiliary/MacOSX directory and run the backup-postfix-binaries .

 #  ./backup-postfix-binaries  

Finally, activate the Postfix installation by using the activate-postfix script:

 #  ./activate-postfix  

This surprisingly useful script automatically does everything you need to finish setting up the installation. The /System/Library/StartupItems/Sendmail startup item is automatically disabled while a /System/Library/StartupItems/Postfix item is created. You can reverse this process by using the script activate-sendmail .

Basic Host Settings

When you reboot your Mac OS X computer, Postfix starts. (You can also start it at any time by typing /usr/sbin/postfix start .) Unfortunately, you need to make a few more settings before the software will run successfully.

Almost all the Postfix configuration you'll perform is done in the /etc/postfix/main.cf . All options in main.cf consist of lines in the form:

  <setting>=<value>[,<value>]  

where <setting> is one of the Postfix directives, and <value> is a simple setting (such as a hostname, timeout value, etc), a path to a hash file, such as hash:/etc/aliases.db , or, in the case of Mac OS X, a NetInfo path, such as netinfo:/aliases . In some cases, lists of values can be used, separated by commas.

WHAT IS A HASH FILE?

A hash file is a binary lookup table that holds key and value pairs. To create a hash file, use either the postmap or postalias commands. Alias files, for example, contain <key> and <value> fields, separated by a colon ( : ) and whitespace, such as this example /etc/aliases file:

 postmaster: root operator: jray admin: jray 

All other hash files simply contain <key> and <value> fields separated by whitespace. The postalias command works exclusively on alias files, whereas postmap is used to generate all other hashes.

To use the Postfix utilities to generate hash files from the corresponding text file, type either postmap <text file> or postalias <alias text file> . Within a few seconds, a binary hash is created in the same location as the original file, with the extension .db .

Edit the /etc/postfix/main.cf file now. To get up and running quickly, you need to tell Postfix what your server's hostname and domain are by using the mydomain and myhostname directives.

Look for the myhostname and mydomain lines, both of which are initially commented out with the # character. Uncomment both of the lines and change them to accurately reflect the state of your server and network. For example, my server is mail.poisontooth.com on the domain poisontooth.com . Thus, my mail.cf file reads:

 myhostname = mail.poisontooth.com mydomain = poisontooth.com 

NOTE

After assignment, these setting variables ( myhostname , mydomain , etc ) can by referenced with a dollar sign ( $ ) in other configuration directives.

Your Postfix server should now be ready to run. To verify the configuration, run /usr/sbin/postfix check . This checks for errors in your setup. Start the server itself by rebooting or typing /usr/sbin/postfix start as root.

 #  /usr/sbin/postfix start  postfix/postfix-script: starting the Postfix mail system 

Verify that Postfix is running by Telneting to port 25 on your server computer. Use the QUIT SMTP command to exit:

 #  telnet localhost 25  Trying 127.0.0.1... Connected to localhost.poisontooth.com. Escape character is '^]'. 220 client1.poisontooth.com ESMTP Postfix QUIT 

Assuming your system responds similarly, everything has gone according to plan and you're ready to fine-tune the Postfix system. For simple setups, this may be as far as you need to go. Postfix automatically configures itself to relay only for those machines on the same class subnet to which you're connected. All others are denied .


   
Top


Mac OS X Maximum Security
Maximum Mac OS X Security
ISBN: 0672323818
EAN: 2147483647
Year: 2003
Pages: 158

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net