man makealiases (Administration système) - Create an alias database
NAME
makealiases - Create an alias database
SYNOPSIS
makealiases [ -protocol=protocol ] [ -alias=filename ] [ -src=pathname ] [ -tmp=filename ] [ -chk ] [ -dump ] [ module ]
DESCRIPTION
Courier's /etc/courier/aliases.dat file is a unified implementation of sendmail-style address aliasing, qmail-style virtual domains, plus several Courier-style enhancements.
The term aliasing refers to substituting one or more addresses for another address. A one-to-one substitution results in Courier accepting mail for one address, and delivering the mail to another address. A one-to-many substitution results in Courier accepting mail for one address, and delivering a separate copy of the message to every address defined by the alias.
/etc/courier/aliases.dat is a binary database file. makealiases creates the binary database file by reading the aliases from plain text files, and makealiases creates /etc/courier/aliases.dat by default.
makealiases creates /etc/courier/aliases.dat from one or more source files, which are plain text files that may be created by any text editor. The format of those source files is defined below. By default, makealiases obtains the source text from /etc/courier/aliases. If this is a text file, it is used verbatim. If this is a directory (Courier creates it as a directory by default), all the non-hidden files in this directory are concatenated together.
OPTIONS
- -alias=filename
- Create filename, instead of /etc/courier/aliases.dat.
- -chk
- Try to search for bad addresses used in the aliases.dat file. This option takes some time to complete. It does not create an aliases.dat file, but instead tries to check every address specified by the source text file. Why is this necessary? That's because non-delivery reports will not be sent to the sender for failures in delivering mail to an aliased address. This is by design. Courier considers aliases to be private mailing lists. Because non-delivery notices are not sent, bad addresses will not be immediately detected. Note: The -chk option is really effective for addresses which are local, because there is no real way to determine if a remote mail address is valid.
- -dump
- Do not create aliases.dat, instead display the contents of the alias database, in plain text form. The contents will be the combined contents of all the source files, with all addresses converted to canonical format, with duplicates removed and sub-aliases expanded.
- -src=pathname
- Use pathname instead of /etc/courier/aliases as the source file. pathname can also refer to a directory. This concatenates every non-hidden file in the directory.
- -tmp=filename
- Use filename as a temporary file, instead of /etc/courier/aliases.tmp. makealiases requires a temporary file for its own purposes, which is automatically removed when done. This temporary file MUST reside on the same filesystem as aliases.dat. If the -alias option specifies a file on a different filesystem, use this option to specify where to temporary place a file in the same filesystem. Because makealiases always uses the same name for a temporary file you cannot run more than one makealiases process at the same time.
- -protocol=protocol
- Use an alias list that's private to messages coming from protocol. See below.
The optional module specifies the module whose rewriting rules are used to convert E-mail addresses into a canonical form. If not specified, the local module's address rewriting rules will be used.
PROTOCOL ALIASES
Addresses in /etc/courier/aliases.dat will be checked in every message. Use the -protocol option to create aliases that will be checked only for message that are received via a specific protocol, such as ESMTP, UUCP, or locally-generated mail. This allows you, for example, to create an alias such as "everyone", which is only avaliable to locally generated mail, and does not work for mail received via ESMTP. The argument to the -protocol option is one of: esmtp, uucp, or local.
Protocol-specific alias files are /etc/courier/aliases-protocol.dat, where "protocol" is the specific protocol, such as "local", "esmtp", or "uucp", and the source file read by makealiases would be /etc/courier/aliases-protocol. If the -protocol option is specified, makealiases will access these files instead of /etc/courier/aliases.dat and /etc/courier/aliases.
ALIAS SPECIFICATIONS
The sources file used to create the binary aliases.dat database are plain text files that may be created using any editor.
Each alias specification takes the following form:
alias: address1, address2, ...
Mail received by Courier addressed to alias will be delivered to the list of addresses specified. The list of addresses may be split across multiple lines, if the second and subsequent line starts with a space character.
Lines starting with the # character are ignored, they are comments.
alias is not restricted to be a local address. It may be any valid RFC 2822 address. All addresses do not necessary have to be in a canonical form.
alias: :include:/absolute/pathname
This notation reads the list of addresses from another file, /absolute/pathname. This file should contain one address per line (comma separated addresses on the same line will also work). Note:
If alias refers to a local, existing, account, this account will never get any mail. Any mail with the account listed as recipient will be redirected to all the addresses specified for that alias. To have a copy of the mail delivered to the account, define it as one of the addresses in the alias itself. For example:
larry: larry, moe, curly, shemp
Larry will still receive his mail, but copies will will also be sent to Moe, Curly, and Shemp. If Larry wasn't specified in the alias, he would never get any mail, it will all be forwarded to Moe, Curly, and Shemp.
DUPLICATE ADDRESSES
Alias definitions may refer to other alias definitions, and makealiases automatically incorporates addresses from other aliases. If the same address is listed in multiple aliases, and two or more of them are specified as recipients of the same message, only one copy of the message will be delivered to the address.
VIRTUAL DOMAINS
The following special syntax implements a virtual domain. A virtual domain redirects all mail for an entire domain to one user:
@domain: user
This special entry results in any recipient address of the form foo@domain to be rewritten as user-foo@me, where me is the hostname of the machine, which we expect to be a local domain.
The following examples use the alias entry "@example.com: john", and "domain.com" is in the control/me file. The address "postmaster@example.com" becomes "john-postmaster@domain.com", and "sales-info@example.com" becomes "john-sales-info@domain.com.
The intended behavior is to use an actual account named john. As a result of the virtual domain address rewriting, delivery instructions for postmaster@example.com can now be specified by john's $HOME/.courier-postmaster file, and delivery instructions for sales-info@example.com may be specified by $HOME/.courier-sales-info. john's $HOME/.courier-default may be used to specify delivery instructions for any other address in the example.com domain, which does not have an explicit .courier file.
If the alias entry was "@example.com: john-example", the corresponding files in john's $HOME directory are .courier-example-postmaster, .courier-example-sales-info, and .courier-example-default. See dot-courier(5) for more information on .courier files. Note:
Virtual domain rewriting is NOT recursive, unlike regular aliases. For example:
tom: john@example.com @example.com: larry
You should explicitly expand the alias out:
tom: larry-john
PROGRAM OR MAILBOX ALIASES
The following notation associates an address directly with a mailbox, or with a program:
info: /var/shared/info
Messages addressed to "info" will be delivered to the mailbox or maildir /var/shared/info. A full pathname must be specified.
info: | /usr/local/shared/info
Mail addressed to "info" will be delivered to the indicated program. The program receives each message on standard input.
Program/mailbox delivery notation is primarily used to support legacy sendmail aliases entries. This is considered to be a legacy feature, and new installations should create a dot-courier(5) file with the necessary delivery instructions. In fact, aliases for programs or mailboxes is not directly supported by Courier's aliasing mechanisms. It's implemented by having the makealiases script automatically create a .courier file, and point the alias address to it.
See dot-courier(5) for more information. Note: Unlike sendmail, Courier delivers as user "daemon" (group daemon) when delivering to programs or mailboxes.
UUCP VIRTUAL DOMAINS
The following notation allows mail addressed to a certain domain to be forwarded via uucp:
@domain: uucp!bang!path!
The trailing ! tells Courier not to append a dash, so user@domain gets rewritten as uucp!bang!path!user, and not uucp!bang!path-user, which is probably not what you want.
DELIVERY STATUS NOTIFICATIONS
An alias with only one address does not affect delivery status notification attributes of an E-mail message.
An alias with multiple addresses is treated like a private mailing list, as defined by RFC 1894. If the message requests a successful delivery notification, Courier generates a delivery status notification for the successful delivery to the aliased address, and each alias recipient address will have DSNs set to NEVER.
BUGS
This has nothing to do with Courier's support for a Qmail-style alias account.
owner-foo feature of sendmail's aliasing is not supported.
Courier normally tries to eliminate duplicate addresses listed as recipients for the same message. Some mail servers are not capable of delivering messages with multiple recipients, and will transmit a separate copy of the same message addressed to each recipient. Courier can't do anything in this case. Each copy of the same original text is considered an individual, separate, message.
Duplicate elimination can fail in certain rare circumstances, involving exotic features of RFC 2822 concerning case sensitivity.
"@example.com: jack, jill" is allowed, but strongly discouraged under the penalty of law.
Because multiple-recipient aliases are treated like private mailing lists, failure DSNs are turned off, and a bad recipient address is hardly noticed by anyone.
The makealiases command may execute while Courier is running, and any changes take effect immediately. However, only one instance of makealiases is permitted to run at the same time.