This section walks through building Postfix with various add-on packages that are mentioned in the book. Before recompiling Postfix with any additional packages, it is important to first clean up from any previous builds. Execute the following:
$ make tidy
Now you'll be starting with a clean source tree for your new builds. Each of the examples below takes you through creating a new Makefile. Once you've accomplished that, simply type:
$ make
to rebuild Postfix. If your new build is successful, you can upgrade your currently installed Postfix:
# make upgrade
If you hadn't previously installed Postfix, use make install instead.
C.5.1 Cyrus SASL
See Chapter 12 for information on Cyrus SASL and Postfix. You can download the source for the Cyrus SASL libraries from the Carnegie Mellon web site at http://asg.web.cmu.edu/sasl/sasl-library.html. Note that this book assumes that you are working with SASL Version 2.x libraries. Follow the instructions for building the Cyrus SASL2 libraries. There is also a SASL_README file that comes with the Postfix distribution.
One issue when compiling Cyrus SASL that affects Postfix is whether or not to include support for certain Microsoft clients that authenticate using a nonstandard mechanism. The standard plain-text authentication mechanism is identified as PLAIN, but these clients use LOGIN. If you need to support such clients, be sure that the libraries are built with the workaround enabled using the --enable-login option when you run configure.
When you install the libraries, be sure to note their location. This example assumes that they are installed in /usr/local/lib and that the header files are located below /usr/local/include. If you are using different locations, adjust the examples accordingly.
To build Postfix with SASL support, you must define the USE_SASL_AUTH macro and specify the directories for the libraries and header files. You must also link against the libsasl2.so library file. Run make tidy if necessary. Build your Makefile with the following options:
$ make makefiles CCARGS='-DUSE_SASL_AUTH -I/usr/local/include/sasl' AUXLIBS='-L/usr/local/lib -lsasl2'
Remember that if you must provide the path to your libraries to the runtime linker, include the correct runtime search path argument:
$ make makefiles CCARGS='-DUSE_SASL_AUTH -I/usr/local/include/sasl' AUXLIBS='-L/usr/local/lib -lsasl2 -rpath /usr/local/lib'
If your linker uses an argument other than rpath, be sure to specify the correct one.
C.5.2 TLS
See Chapter 13 for information on the TLS patches and Postfix. You can find the web site for the TLS patches from the "Add-on Software" page of the Postfix web site. Since this add-on modifies the Postfix source, make sure you get the correct download for your version of Postfix. For this example, assume the downloaded file is called pfixtls-0.8.13-2.0.10-0.9.7b.tar.gz. If the file you download is different, adjust the examples accordingly.
This add-on depends on the OpenSSL library, which you must install first if it's not already on your system. Check the documentation that comes with the TLS distribution to make sure you have the correct version of OpenSSL. For this example, assume that your OpenSSL libraries are installed in /usr/local/ssl/lib and the header files are in /usr/local/ssl/include. If your installation differs, adjust the example accordingly.
The TLS modifications to the Postfix source are all contained in the file pfixtls.diff, and you use the patch command to apply the differences to your Postfix source. You should uncompress and untar the TLS patch in a subdirectory that is at the same level as your Postfix directory such that if your current directory is the one above the Postfix source, you can see both the Postfix directory and the TLS patch directory:
$ pwd /home/kdent $ ls -ld pfixtls-0.8.13-2.0.10-0.9.7b postfix-2.0.10 drwxr-xr-x 5 kdent kdent 512 May 14 2002 pfixtls-0.8.13-2.0.10-0.9.7b drwxr-xr-x 15 kdent kdent 1024 May 31 17:31 postfix-2.0.10
From that directory apply the patch as follows:
$ patch -p0 < pfixtls-0.8.13-2.0.10-0.9.7b/pfixtls.diff
patch reports the changes as it makes them until it finishes and displays "done" on your terminal.
Go back to the Postfix distribution directory to build Postfix with TLS support. You must define the HAS_SSL macro and specify the directories for the SSL libraries and header files. You must also link against the libssl.so (or libssl.a) and libcrypto.so (or libcrypto.a) library files. Run make tidy if necessary. Build your Makefile with the following options:
$ make makefiles CCARGS='-DHAS_SSL -I/usr/local/ssl/include' AUXLIBS='-L/usr/local/ssl/lib -lcrypto -lssl'
Remember that if you must provide the path to your libraries to the runtime linker, include the correct runtime search path argument:
$ make makefiles CCARGS='-DUSE_SASL_AUTH -I/usr/local/ssl/include' AUXLIBS='-L/usr/local/ssl/lib -lcrypto -lssl -rpath /usr/local/ssl/lib'
If your linker uses an argument other than rpath, be sure to specify the correct one.
C.5.3 MySQL
See Chapter 15 for information on MySQL and Postfix. This add-on depends on the MySQL client library and the zlib compression library, which you must install first if they're not already on your system. This example assumes that your MySQL library is installed in /usr/local/lib/mysql with its header files in /usr/local/include/mysql and that the zlib library is in /usr/lib. If your installation differs, adjust the example accordingly. There is a MYSQL_README file that comes with the Postfix distribution with information about building Postfix with support for MySQL.
To build Postfix with MySQL support, you must define the HAS_MYSQL macro and specify the directories for the MySQL library and header files. You must link against the libmysqlclient.so and the libz.so library files. You must also link against the libm.so math library file, which is standard on Unix systems. Run make tidy if necessary. Build your Makefile with the following options:
$ make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/include/mysql' 'AUXLIBS=-L/usr/local/lib/mysql -lmysqlclient -lz -lm'
Remember that if you must provide the path to your libraries to the runtime linker, include the correct runtime search path argument:
$ make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/include/mysql' 'AUXLIBS=-L/usr/local/lib/mysql -lmysqlclient -lz -lm -rpath /usr/local/lib/mysql'
If your linker uses an argument other than rpath, be sure to specify the correct one.
C.5.4 LDAP
See Chapter 15 for information on LDAP and Postfix. This add-on depends on LDAP libraries, which you must install first if they're not already on your system. There are commercial libraries available as well as an open source package from http://www.openldap.org/. This example assumes that you have LDAP libraries installed in /usr/local/lib/ and LDAP header files in /usr/local/include. If your installation differs, adjust the example accordingly. There is an LDAP_README file that comes with the Postfix distribution with information about building Postfix with support for LDAP.
To build Postfix with LDAP support, you must define the HAS_LDAP macro and specify the directories for the LDAP libraries and header files. You must link against the libldap.so library file and also the liblber.so library file, which defines encoding routines for the LDAP protocol. Run make tidy if necessary. Build your Makefile with the following options:
$ make makefiles CCARGS='-I/usr/local/include -DHAS_LDAP' AUXLIBS='-L/usr/local/lib -lldap -L/usr/local/lib -llber'
Remember that if you must provide the path to your libraries to the runtime linker, include the correct runtime search path argument:
$ make makefiles CCARGS='-I/usr/local/include -DHAS_LDAP' AUXLIBS='-L/usr/local/lib -lldap -L/usr/local/lib -llber -rpath /usr/local/lib'
If your linker uses an argument other than rpath, be sure to specify the correct one.
Introduction
Prerequisites
Postfix Architecture
General Configuration and Administration
Queue Management
Email and DNS
Local Delivery and POP/IMAP
Hosting Multiple Domains
Mail Relaying
Mailing Lists
Blocking Unsolicited Bulk Email
SASL Authentication
Transport Layer Security
Content Filtering
External Databases
Appendix A. Configuration Parameters
Appendix B. Postfix Commands
Appendix C. Compiling and Installing Postfix
Appendix D. Frequently Asked Questions