UNIX System Administration Handbook - Evi Nemeth [367]
Masquerading is supported but not in as many variations as sendmail allows. Virtual address mapping is done by table lookups, as it is in sendmail. Redirects are implemented with the relocated users table (relocated_maps variable). Aliases and .forward files are supported and look just like sendmail’s. Even the luser_relay (pronounced “loser relay”) for handling “user unknown” messages is supported.
Relaying is turned off by default, but the exact default behavior is a bit different from that of sendmail. sendmail does no relaying at all by default; Postfix relays for your own domains, subdomains, and class A, B, or C networks.
Spam control
Postfix uses regular expressions, database tables, and the MAPS project’s black hole lists to filter out spam. Table 19.22 shows some of Postfix’s spam-related variables.
Table 19.22 Variables that affect Postfix’s spam filtering
If a message matches a table lookup and the table value is REJECT, then the message is rejected with an appropriate error message. For the Perl hackers among our readers, here is an example of a regular expression used in one site’s spam filters:
/^friend@.*$/ 550 Stick this in your pipe $0
If you really had a user named “friend” at your domain, you could exclude that user from the friendly error message with:
/^friend@(?!mysite.com).*$/ 550 Stick this in your pipe $0
To use the MAPS projects black hole lists, add the following to your main.cf file:
maps_rbl_domains =
rbl.maps.vix.com
dul.maps.vix.com
relays.mail-abuse.org
smtpd_client_restrictions = reject_maps_rbl
Postfix examples
Since our experience with Postfix is much more limited than our experience with sendmail, we asked Wietse for some examples. The conf directory of the Postfix distribution also contains several examples.
In a Postfix mail hub/client environment, all systems send mail as user@domain. All systems receive mail for user@hostname; the hub receives mail for user@domain, too.
On the clients, /etc/postfix/main.cf contains:
myorigin = $mydomain
On the mail hub, /etc/postfix/main.cf looks like this:
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, $mydomain
To modify this configuration so that the workstation receives no mail from the network and relays everything through a mail hub, you must change both the main.cf configuration file and the master.cf daemon configuration file.
Client /etc/postfix/main.cf:
myorigin = $mydomain
relayhost = $mydomain
On the clients, comment out the SMTP server line in /etc/postfix/master.cf:
#smtp inet n - n - - smtpd
If you export the mail queue over NFS to clients, the clients need only the Postfix mail posting agent and zero-length main.cf and master.cf files.
Here’s an example where mail comes in and out to individual hosts, but messages in BITNET or UUCP format are forwarded to the master.
The hub’s configuration is:
myorigin = $mydomain
mydestination = $myhostname,localhost.$mydomain,$mydomain
transport_maps = hash:/etc/postfix/transport
The clients use:
myorigin = $mydomain
transport_maps = hash:/etc/postfix/transport
On both the master machine and the clients, /etc/postfix/transport should contain:
.bitnet smtp:master
.uucp smtp:master
1. The receiving users’ mailboxes or, sometimes, a database.
2. Some feel that the primary effect of the MIME standard has been to convert the Internet’s open email format into a morass of proprietary subformats. The dust is still settling.
3. /usr/ucb/mail is sometimes called /bin/mailx or /bin/Mail on systems derived from System V.
4. Outlook Express is a free, slightly crippled mail reader from Microsoft that has no relationship to the commercial product Microsoft Outlook.
5. IMAP is preferred over POP these days.
6. Technically, aliases are configured only by sysadmins. The user’s control of mail routing by use of a .forward file is not really aliasing, but we have lumped them together here.
7. The default hop limit is 25, but you