Wednesday, February 17, 2010

2. Postfix Post Installation and Initial Configuration

Postfix has 2 key configuration files
1. configuration file role is to drive the master process and if necessary spawn additional daemons to manage our environment according to the configuration.
# cat /etc/postfix/
    /usr/libexec/postfix/master is the binary which was installed by the postfix, reads the file and based on the directives in the file the master binary knows which daemons has to be started.
For Eg:- Since the smtp service is mentioned in the file it starts the daemon smtpd.
The file format or header values of various columns in the file is as below:
service    type    private    unpriv    chroot    wakeup   maxproc    command    + args
    This is the service name provided by the daemon. eg:- smtp, qmgr, rewrite
    This defines whether the service is (inet) internet based, or unix named socket (fifo) or unix domain socket(unix) etc. inet are tcp or udp protocol based daemons
    Only the local services can be configured as the private.
    Service can run as unprivate mode
    This defines the daemon about running in chrooted environment.
    This defines the wake up intervals for each services, For eg:- qmgr has 300. pickup has interval 60 by default. This makes the flexibility of postfix installation that each and every process has been carried out by separate binaries and the properties of those binaries can be defined in file.
    This defines the max process that can be invoked
command  + args:
    This defines the actual command to start the daemon with any required additional arguments.
If a "-" (hyphen) is defined then that means use the default configuration option for the given service
The file is responsible for spawning all the binaries of postfix service.

2. contains the directives to drive postfix on our environment.
The key directives that has to be configured for running the postfix with minimal configuration is defined below
Open the file and change the key derivatives
# vim /etc/postfix/
myhostname = mail.$mydomain
# the host name can be FQDN or host.domain format or just the hostname itself
mydomain =
myorigin = $mydomain
# This option is for sending the mail.This pertains the msgs are sourced from the local machine. This tells the postfix how to present the from address in the msg header and envolop even if it sending the msg to same system. The above example will send the locally generated mail with the address
# myorigin = $myhostname
    This option will make postfix to send mail with the envelop with full host name(FQDN because the myhostname is defined as hostname.$mydomain), i.e
mydestination = $myhostname, localhost, localhost.$mydomain
# This tells the postfix that which hosts and domains the postfix receives the mails for. This is the replacement of the local-host-names file.
    These are the main configuration changes that needed to start postfix with minimal configurations. Now save the file and start the postfix
# postfix start
# ps -ax |grep master
    Here now we can see that master process is running
# netstat -ntulpn | grep :25
    The port 25 is opened and listening. The master process is running now, which resembles like the inted daemon in Linux machine, because it spawns the binary when necessary.

Configuring postfix to recieve mail having the To address as
    Until and unless we specify the following options the postfix server will not be able to accept the mail for the given domian.
# vim /etc/postfix/
mydomains =
mydestination = $myhostname, $mydomain, localhost.localdomain
relay_domains = $mydestination
# postfix reload
    The "mydestination" derivative tells postfix that for which domains it recieves the mail for.
With out the domain information entry in all the three derivatives the postfix will not be able to handle the msgs destined to the With out this entry the postfix will bounce back the msg to the client saying the "msg loop back to my self".

No comments:

Post a Comment

tag ur valuable ideas below