The main.cf Configuration File (Postfix)
The default main.cf file lists only a portion of the nearly 300 Postfix parameters. You can edit main.cf with the postconf command.
Comment lines start with the # character and continue to the end of the line. Blank and comment lines are ignored by Postfix.
Topic:-1
Parameters can appear in any order within the file, and are written as you would expect:
parameter = value
A parameter definition must start in the first column of the line. The spaces around the equals sign are optional.
Here is an example parameter assignment with a comment:
# The myhostname value must be a fully qualified hostname.
myhostname = mail.example.com
You cannot have a comment on the same line as a parameter.
# This is a bad parameter assignment. Never do this.
#
myhostname = mail.example.com # must be fully qualified hostname
Do not use quotation marks around values. They have no significance in the Postfix configuration, so they would be considered part of the value.
Topic:-2
A line that starts with whitespace (tabs or spaces) is considered a continuation of the previous line.
mydestination = example.com oreilly.com ora.com postfix.org
is the same as:
mydestination = example.com
oreilly.com
ora.com
postfix.org
Topic:-3
You can refer to the value of a defined parameter by putting a $ in front of the parameter name:
mydomain = example.com
myorigin = $mydomain
This causes the value of myorigin to be “example.com.”
You can reference a value in the file even before it has been set.
Topic:-4
Many parameters can have more than one value. Multiple values can be separated by commas, spaces, tabs, or new lines.
mydestination = $mydomain, example.com, oreilly.com
mydestination = $mydomain example.com oreilly.com
mydestination = $mydomain
example.com
oreilly.com
These three assignments to mydestination are effectively the same.
Certain parameters allow you to place multiple values in a text file and then point the parameter to that file in main.cf. A value that starts with a forward slash is assumed to be a pointer to a file.
If your system receives mail locally for many destinations, you may want to keep the list of destinations in a separate file. Then point the mydestination parameter to that file:
mydestination = /etc/postfix/destinations
The parameters that can use external files to store values are those that accept lists where the order of the listed items is not significant, such as mynetworks, mydestination, and relay_domains.
Whenever you make a change to main.cf, you must reload Postfix for your changes to go into effect:
# postfix reload
Topic:-5
Many parameters point to lookup tables to obtain important configuration information. One such
parameter is canonical_maps. It’s used to rewrite email addresses in messages.
Consider a site that uses account names internally for email addresses, but wants any publicly visible addresses to have the form firstname.lastname@example.com. For example, the address kdent@example.com should appear as kyle.dent@example.com. A canonical_maps lookup table provides the mapping from a key (kdent@example.com) to a value (kyle.dent@example.com).
Lookup tables start as simple text files, with each key and value on the same line separated by spaces or tabs:
#
# canonical mappings
#
kdent@example.com kyle.dent@example.com
Keys in lookup tables are not case-sensitive
Once you have created a text file with all of your mappings, you have to execute the postmap command against it to create the actual indexed version of the file:
# postmap /etc/postfix/canonical
The postmap command can also be used to query lookup tables. Use the -q option to query a value:
# postmap -q kdent@example.com /etc/postfix/canonical
kyle.dent@example.com
Topic:-6
Different types of Unix database files have different internal formats. Normally Postfix supports one or more of three types: btree, dbm, and hash. The postconf command with the -m option lists all of the map types supported by your installation of Postfix:
$ postconf -m
static
pcre
nis
regexp
environ
proxy
btree
unix
hash
The default_database_type parameter tells you which database type Postfix uses by default:
$ postconf default_database_type
default_database_type = hash
If you don’t specify a database type with postmap, it automatically uses your default type. In general, you can just use the default type configured on your system, but you must know what it is when assigning lookup tables to mapping parameters.
When you assign a lookup table to a parameter, you must specify both the map type and the path to the lookup table. The format of lookup maps is:
parameter = type:name
where type is the storage access method and name is the resource containing keys and values. With indexed datafile lookups, name is the filename. The canonical example is assigned as follows:
canonical_maps = hash:/etc/postfix/canonical
You can assign multiple lookup tables to a parameter. Postfix searches the tables in the order listed, stopping as soon as it finds a match. Some table lookups are recursive, depending on the parameter.
You may have noticed that when postmap indexes files, it creates additional files. postmap creates either one additional file with the extension .db, or two additional files with the extensions .dir and .pag, depending on your database format. When you assign the lookup table to its parameter, specify the path and filename without any extensions.
Topic:-07
Comments
Post a Comment