Tuesday, February 16, 2010

1. Postfix Installation


Introduction
    In December of 1998, IBM released Secure Mailer as open source software providing a new, freely available alternative to the nearly universal Sendmail program. The program, more commonly known in open-source circles as Postfix, attempts to be fast, easy to administer, and secure. Originally written in 1997 by Wietse Venema at the IBM Thomas J. Watson Research Center and first released in December 1998, Postfix continues as of 2010 to be actively developed by its creator and a small number of contributors. The software is also known under its former names VMailer and IBM Secure Mailer. One of the primary goals of Postfix is to be widely implemented in order to make the most significant impact on the performance and security of Internet email overall. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different.

Features of Postfix
Refer:

Download & Install Postfix
    Download the latest version of source from http://www.postfix.org. Download the PGP key and signature as well to verify the source code integrity.Postfix released versions of packages are denoted as postfix.xx.xx.xx.tgz. For example in package postfix.2.6.5.tgz the version can be defined as postfix.MajorRelease.MinorRelease.patch level.tgz.
After downloading we have to match the gpg keys before compiling and installing the package
# gpg --import wiestse.pgp
    The GPG is compatible with the PGP. The above command imports the PGP key downloaded from the Postfix website.
# gpg --list-keys
    Lists all the keys that have imported to GPG.
# gpg --verify postfix-xx.xx.xx.tgz.sig postfix-xx.xx.xx.tgz
    It gives the information about the signature. If there any critical error occurs, have to be taken care and a fresh source code package has to downloaded.

# tar -zxvf postfix-xx.xx.xx.tgz
    Extracts the postfix package and creates the new directory structure named postfix-xx.xx.xx.
Note:-
    It is better to remove all the Mailer programs in the system before installation of the source.
Inside the extracted package the "conf" directory contains the configuration files that moves to /etc/postfix directory after installation. Directory "examples" contains the advanced secured configurations of postfix which includes chroot-setup, qmail-local(how to operate with Qmail), And ways to define the smtp-policy etc. Many binaries such as Sendmail and Postfix tend to run as root. But Postfix has an exception that, Postfix primarily runs as user "postfix", but some of the components need the root privilages such as binding to port 25.
Other directory called "html" contains the documentation of postfix in HTML format so that we can brows through a web client locally. "man" folder contains the man pages that can be copied to system while installation. "src" sub directory holds all the codes for the binaries that produces as a result of the compilation process.


Compiling and Installing  Postfix
Pre-Requisites before compiling Postfix:
    1. As root have to add user & group called postfix and a separate group called "postdrop".
# groupadd postfix
# useradd -g postfix -s /bin/false postfix
    The user postfix doesn't need to have a shell access.
# groupadd postdrop
    2. Backup the binaries which will be over written by postfix installation.
        newaliases - Which generates the aliases
        mailq         - enumerates the mails in the queue
        sendmail    - the Sendmail binaries
            Now backup these binaries, just a renaming will be sufficient. Because all Linux distros ships with a Mailer agent which may contain these binaries.
Compile and install postfix
# cd postfix-2.6.5/
# make
    This makes the binaries with default options.
# make install
    This will install the binaries in to the system folders.
While executing this command, postfix will ask certain questions including the following:-
The install_root - The temp space for installation location
The default configuration directory
The daemon directory
Path of the administrative user command directory
Queue directory
The sendmail path (The postfix provides a sendmail compatible binary which accepts all the command line options that sendmail do)
newalialses path
mailq path
The mail owner
setgid group (here we defines the mail submission group, i.e, postdrop. It is equvalent to sendmail's MSP)
The html documentation location
The man page directory (install with respect to the $MANPATH variable)
Readme file access etc
    After providing the information,the Postfix installation process will start (copies the binaries into the path).

Installed binaries and files:
/usr/libexec/postfix
     This folder contains the binaries which runs as daemons in background as well some applications that are invoke upon necessary. Main binaries are qmgr, cleanup, flush, smtpd. The most important binary is the master binary, which starts while we invoke the postfix daemon (service postfix start).
/usr/sbin
    This folder will be containing postalias, postcat, postfix, sendmail, etc
/var/spool/
    This folder contains folders called Postfix. Postfix perform all of his mail handling in this "postfix" directory including.
/etc/postfix
    This folder contains the key configuration files

Initial configuration before starting the postfix at very first time
    With the default configuration, Postfix returns the warning of hostname is not fully qualified. The hostname search is done by postfix using the binary "hostname ". This returns the short hostname. The FQDN returns with the command "hostname -f". The mailing is relying upon the proper name so its vital to specify the proper FQDN in /etc/postfix/main.cf. Same way we have to define the myorigin,mydestination and mynetworks parameter in same file. /etc/aliases file should be set and the "newalialses" binary should be executed before starting the postfix service.

No comments:

Post a Comment

tag ur valuable ideas below