2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-09-05 08:35:26 +00:00
Files
postfix/postfix/man/man5/virtual.5
2013-02-05 06:28:35 +00:00

230 lines
7.9 KiB
Groff

.TH VIRTUAL 5
.ad
.fi
.SH NAME
virtual
\-
format of Postfix virtual alias table
.SH SYNOPSIS
.na
.nf
\fBpostmap /etc/postfix/virtual\fR
\fBpostmap -q "\fIstring\fB" /etc/postfix/virtual\fR
\fBpostmap -q - /etc/postfix/virtual <\fIinputfile\fR
.SH DESCRIPTION
.ad
.fi
The optional \fBvirtual\fR alias table specifies address aliasing
for arbitrary local or non-local recipient addresses. Virtual aliasing
is recursive, and is done by the Postfix \fBcleanup\fR(8) daemon.
The main applications of virtual aliasing are:
.IP \(bu
To redirect mail for one address to one or more addresses.
.IP \(bu
To simulate virtual domains where all virtual addresses are aliased
to non-virtual addresses.
.sp
Simulated virtual domains are not to be confused with the true virtual
domains that are implemented with the Postfix \fBvirtual\fR(8) mail
delivery agent.
.PP
Virtual aliasing is applied only to recipient
envelope addresses, and does not affect message headers.
Think Sendmail rule set \fBS0\fR, if you like. Use \fBcanonical\fR(5)
mapping to rewrite header and envelope addresses in general.
Normally, the \fBvirtual\fR alias table is specified as a text file
that serves as input to the \fBpostmap\fR(1) command.
The result, an indexed file in \fBdbm\fR or \fBdb\fR format,
is used for fast searching by the mail system. Execute the command
\fBpostmap /etc/postfix/virtual\fR in order to rebuild the indexed
file after changing the text file.
When the table is provided via other means such as NIS, LDAP
or SQL, the same lookups are done as for ordinary indexed files.
Alternatively, the table can be provided as a regular-expression
map where patterns are given as regular expressions. In that case,
the lookups are done in a slightly different way as described below.
.SH TABLE FORMAT
.na
.nf
.ad
.fi
The format of the virtual table is as follows, mappings being
tried in the order as listed in this manual page:
.IP "\fIpattern result\fR"
When \fIpattern\fR matches a mail address, replace it by the
corresponding \fIresult\fR.
.IP "blank lines and comments"
Empty lines and whitespace-only lines are ignored, as
are lines whose first non-whitespace character is a `#'.
.IP "multi-line text"
A logical line starts with non-whitespace text. A line that
starts with whitespace continues a logical line.
.PP
With lookups from indexed files such as DB or DBM, or from networked
tables such as NIS, LDAP or SQL, patterns are tried in the order as
listed below:
.IP "\fIuser\fR@\fIdomain address, address, ...\fR"
Mail for \fIuser\fR@\fIdomain\fR is redirected to \fIaddress\fR.
This form has the highest precedence.
.IP "\fIuser address, address, ...\fR"
Mail for \fIuser\fR@\fIsite\fR is redirected to \fIaddress\fR when
\fIsite\fR is equal to $\fBmyorigin\fR, when \fIsite\fR is listed in
$\fRmydestination\fR, or when it is listed in $\fIinet_interfaces\fR.
.sp
This functionality overlaps with functionality of the local
\fIaliases\fR(5) database. The difference is that \fBvirtual\fR
mapping can be applied to non-local addresses.
.IP "@\fIdomain address, address, ...\fR"
Mail for any user in \fIdomain\fR is redirected to \fIaddress\fR.
This form has the lowest precedence.
.PP
In all the above forms, when \fIaddress\fR has the form
@\fIotherdomain\fR, the result is the same user in \fIotherdomain\fR.
This works for the first address in the expansion only.
.SH ADDRESS EXTENSION
.na
.nf
.fi
.ad
When a mail address localpart contains the optional recipient delimiter
(e.g., \fIuser+foo\fR@\fIdomain\fR), the lookup order becomes:
\fIuser+foo\fR@\fIdomain\fR, \fIuser\fR@\fIdomain\fR, \fIuser+foo\fR,
\fIuser\fR, and @\fIdomain\fR. An unmatched address extension
(\fI+foo\fR) is propagated to the result of table lookup.
.SH SIMULATED VIRTUAL DOMAINS
.na
.nf
.ad
.fi
Besides virtual aliases, the virtual alias table can also be used
to simulate virtual domains. With a simulated virtual domain, all
recipient addresses are aliased to non-virtual addresses. These
non-virtual addresses may be either local or remote.
Simulated virtual domains are not to be confused with the true virtual
domains that are implemented with the Postfix \fBvirtual\fR(8) mail
delivery agent. With true virtual domains, each recipient address can
have its own mailbox.
With a simulated virtual domain, the virtual domain has its
own user name space. Local (i.e. non-virtual) usernames are not
visible in a simulated virtual domain. In particular, local
\fBaliases\fR(5) and local mailing lists are not visible as
\fIlocalname@simulated.domain\fR.
Support for a simulated virtual domain looks like:
/etc/postfix/main.cf:
.in +4
virtual_alias_maps = hash:/etc/postfix/virtual
Note: some systems use \fBdbm\fR databases instead of \fBhash\fR.
See the output from \fBpostconf -m\fR for available database types.
.ti -4
/etc/postfix/virtual:
.nf
.na
\fIsimulated.domain anything\fR (right-hand content does not matter)
\fIpostmaster@simulated.domain postmaster\fR
\fIuser1@simulated.domain address1\fR
\fIuser2@simulated.domain address2, address3\fR
.fi
.in -4
.ad
.fi
.sp
The \fIsimulated.domain anything\fR entry is required for a
simulated virtual domain. Without this entry, mail will
be rejected with a "relay access denied" error condition.
Do not list a simulated virtual domain name in the \fBmain.cf
mydestination\fR configuration parameter.
With a simulated virtual domain, the Postfix SMTP server
accepts mail for \fIknown-user@simulated.domain\fR, and rejects
mail for \fIunknown-user\fR@\fIsimulated.domain\fR as undeliverable.
Instead of specifying the simulated virtual domain name via
the \fBvirtual_alias_maps\fR table, you may also specify it via
the \fBmain.cf virtual_alias_domains\fR configuration parameter.
This latter parameter uses the same syntax as the \fBmain.cf
mydestination\fR configuration parameter.
.SH REGULAR EXPRESSION TABLES
.na
.nf
.ad
.fi
This section describes how the table lookups change when the table
is given in the form of regular expressions. For a description of
regular expression lookup table syntax, see \fBregexp_table\fR(5)
or \fBpcre_table\fR(5).
Each pattern is a regular expression that is applied to the entire
address being looked up. Thus, \fIuser@domain\fR mail addresses are not
broken up into their \fIuser\fR and \fI@domain\fR constituent parts,
nor is \fIuser+foo\fR broken up into \fIuser\fR and \fIfoo\fR.
Patterns are applied in the order as specified in the table, until a
pattern is found that matches the search string.
Results are the same as with indexed file lookups, with
the additional feature that parenthesized substrings from the
pattern can be interpolated as \fB$1\fR, \fB$2\fR and so on.
.SH BUGS
.ad
.fi
The table format does not understand quoting conventions.
.SH CONFIGURATION PARAMETERS
.na
.nf
.ad
.fi
The following \fBmain.cf\fR parameters are especially relevant to
this topic. See the Postfix \fBmain.cf\fR file for syntax details
and for default values. Use the \fBpostfix reload\fR command after
a configuration change.
.IP \fBvirtual_alias_maps\fR
List of virtual aliasing tables.
.IP \fBvirtual_alias_domains\fR
List of simulated virtual domains. This uses the same syntax
as the \fBmydestination\fR parameter.
.PP
Other parameters of interest:
.IP \fBinet_interfaces\fR
The network interface addresses that this system receives mail on.
You need to stop and start Postfix when this parameter changes.
.IP \fBmydestination\fR
List of domains that this mail system considers local.
.IP \fBmyorigin\fR
The domain that is appended to any address that does not have a domain.
.IP \fBowner_request_special\fR
Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR
addresses.
.SH SEE ALSO
.na
.nf
cleanup(8) canonicalize and enqueue mail
postmap(1) create mapping table
regexp_table(5) POSIX regular expression table format
pcre_table(5) Perl Compatible Regular Expression table format
.SH LICENSE
.na
.nf
.ad
.fi
The Secure Mailer license must be distributed with this software.
.SH AUTHOR(S)
.na
.nf
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA