Thursday, February 18, 2010

4. Postfix Aliases & .forward file

    The common entries in aliases file are postmaster, abuse etc. The default aliases file is located at the /etc/aliases used by Postfix. Also postfix will install the aliases file inside the directory /etc/postfix. The text file is converted to a db file using newaliases command. Aliases file are subjected to grow very large (If it is large company they will have numerous alias entries ), as a result the MTA's will be in much advantage to place these alias entries in a database format for fast and reliable enquiry. The aliases database are by default in "Hash" format. Postfix supports Hash, DBMS etc.
# file /etc/aliases.db
Check your aliases.db file with above command.

Aliases Type
    We already have a detailed description about aliases - Refer Below URL
Postfix aliases file has same format as sendmail server use. In fact aliases feature has been taken from sendmail.

Convert Sendmail Aliases File To Postfix
      The change that have to be made in the aliases file is adding the postfix user aliases pointing to user root Thus converting a sendmail aliases file to postfix.
#vim /etc/aliases
postfix: root
# newaliases
# postfix reload
    This is the aliases requirement for the postfix daemon according to postfix documentation. Also we can use the aliases file that created with the installation of postfix. This can be useful if we are creating a new mail server.

Forwarding(Making use of the .forward file) in Postfix
     As in Sendmail if we define a local .forward file in the users home directory Postfix similar to sendmail will attempt to process the ~/.forward file. This .forward file follows the similar syntax as the /etc/aliases file. Any msgs destined to a user can be further forwarded or redirected using .forward file. It allows the user to have control on forwarding the mails.
For Eg:-
The Vacation program is setup by using this .forward file

Setting up Vacation Program
   Go to the home directory of the user 
# cd ~
   Enter the out of office msg
# vim .vacation.msg
Hi thanks for the mail.. I will revert back once I am back
Create the .forward file
# vim .forward
\user, "|/usr/bin/vacation user"
      \user makes postfix to no further look up in the aliases.This enables the vacation program once a mail reaches the user mail box
# vacation -i
This initialise the vacation.db file. This instruct postfix to respond for all the incoming msgs.
Test the vacation program by sending mail to the "user". The user will return a mail with the contends on .vacation.msg

1 comment:

tag ur valuable ideas below