Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Postfix lookup tables (index files)

&pagelevel(4)&pagelevel

Postfix uses a number of lookup tables to permit efficient searching for information on address substitution, access control, etc. In a lookup table for address substitution, for instance, the old address is the search criterion, while the new address is assigned to the search criterion as the search result. In a lookup table for access control, for example, all local e-mail recipients which Postfix accepts can be listed. Here it is only important for Postfix to know whether the search criterion exists. The search result as such is of no importance.

The information provided via the lookup tables is initially entered in ordinary text files by the administrator of the Postfix mail server. However, for high-performance access to this information Postfix does not use the text files (source files) created by the administrator, but index files which the administrator generates from the source files with the aid of the postmap (see "postmap - Generating and processing index files (Postfix format)") or postalias (see "postalias - Generating and processing index files (alias format)") program.

postalias differs from postmap in the format required for postalias source files (alias files) which, owing to its compatibility with the Sendmail server, deviates slightly from the source file format of the other Postfix source files for lookup tables (see "Postfix lookup tables (index files)").


Two different types of index files

The BS2000 ported version of Postfix supports two different types of index files:

  • hash files: Here the search is based on hash tables and algorithms.

  • btree files: Here the search is based on Balanced-Tree (B-Tree) structures and algorithms.

Normally it is advisable to use the hash format. The use of btree files can make sense if performance problems occur with very large lookup tables in hash format.
Storage of lookup tables in external databases or directories such as NIS, MySQL or LDAP which is fundamentally possible with Postfix is currently not supported by the BS2000 ported version.


General Postfix format for postmap source files

An entry (logical line) in a postmap source file has the following syntax:

Key White space Value

Key

Search criterion

White space

White space consists of a sequence of blanks and/or tabulator characters. White space must contain at least one blank or tabulator character.

Value

Information which is assigned to the search criterion.

In addition, the following rules apply for the format of a logical line:

  • A logical line can extend over several text lines.

  • A logical line starts with a text which is different from the white space.

  • A line which begins with white space continues a logical line.

  • Empty lines and lines which - possibly after a white space - begin with “#” are ignored by postmap.


Format for postalias source files (alias files)

With the aid of aliases the user part of a local receiver address can be replaced by one or more receiver addresses.

You can enter the following as receiver addresses:

  • Local addresses

  • Remote addresses

  • Programs to which messages are transferred

  • Files in which the messages are saved

The aliases are defined by entries in an alias file. The default file name of the alias file is /etc/postfix/aliases.

An alias entry (alias definition) has the following syntax:

Name: Value1, Value2, Value3, ..., Value n

Name

User part of a local receiver address. If the user part of a local receiver address contains special characters such as “@” or blanks, it must be enclosed in double quotes (""). The value of the user part of a local receiver address is always stored in lower case.


The alias file must always contain the entries for the local names “postmaster” and ”MAILER-DAEMON” (requirement of RFC 822).


Value1, Value2, Value3, ..., Valuen

One or more receiver addresses.

The following can be specified as Value i, i = 1 ... n:

  • Local name (e.g. sysroot)

  • Remote address (e.g. user@domain.com)

  • / File

    In this case the message is by default appended to the end of the File file. The allow_mail_to_ files parameter in the Postfix configuration file main.cf enables you to suppress this behavior.

  • | Program

    In this case the message is by default transferred via a pipe to a program call Program. The allow_mail_to_commands parameter in the main.cf file enables you to suppress this behavior. If the program call contains special characters (in particular blanks), you must enclose it in double quotes ("").

  • :include: File

    File is a text file which allows you to define mailing lists, for example. The e-mails are sent to the recipients listed in these mailing lists. Blanks and lines which begin with “#” are ignored. All other lines in File have the same syntax as the right-hand sides of alias entries, i.e. Value , Valuet , ..., Value n.

    With :include: File, entries to be appended to files (| File) or to be transferred to program calls via a pipe (|Program) are ignored unless otherwise specified. The main.cf parameters allow_mail_to_ files and allow_mail_to_commands enable you to activate the appending of entries to files or the transfer of entries to program calls as the default option.

  • owner- aliasname: owner_mail_address

    You use this entry to define an owner or administrator for the mailing list aliasname who has the mail address owner_mail_address. In the event of an error (undeliverable e-mail) the notification is then sent to owner_mail_address and not to the sender of the mail since the owner / administrator of the mailing list can generally react to delivery problems better than the sender of the mail.

    If, for example, a mailing list with the name “dbadmin” is defined, the following entry defines the mail address (here: “owner-mail-address”) of the mailing list’s owner:

    owner-dbadmin: owner-mail-address

If at the end of alias conversion it is determined that the message is to be delivered to a local user, Postfix checks whether this user’s home directory contains a .forward file. If this is the case, a further stage of alias conversion is performed in which the .forward file is interpreted according to the same rules as an alias file.


Example

An example of an alias file is shown below.

# Alias file
# Forward error messages to postmaster and append them
# to logging file /var/adm/mailerr
MAILER-DAEMON:   postmaster, /var/adm/mailerr
# Forward postmaster to system administrator ID
postmaster:      sysroot
# Forward messages addressed to system administrator
# to real person
sysroot:         mueller
# Program for automatic mail answering
auto-test:       |"/home/rwk/auto-test -i 3"
# Mailing list
dbadmin:         :include:/home/admin/db-admins
owner-dbadmin:   postmaster

This owner-dbadmin alias means that errors, e.g. undeliverable mails to dbadmin, are not sent to the orignial sender but to postmaster.

Content of /home/admin/db-admins:

amueller@firma.example
bmeier@firma.example
dhuber@firma.example
/home/admin/db-admins.maillog