ALIASES(5)

πŸ“¦
version 3.10.14 Β· 3 versions
, in fedora 43, fedora 44

πŸ’– aliases(5) β€” the Postfix local alias database format πŸ’–

okay bestie, welcome to the File Formats Manual section 5, and this one is aliases β€” the Postfix local alias database format. yes, that alias file. the one you've been editing with your eyes closed. let's actually understand it tho πŸ’…


✨ SYNOPSIS ✨

newaliases
postalias -q name [file-type]:[file-name]

🌸 DESCRIPTION 🌸

the optional aliases(5) table β€” that's alias_maps β€” redirects mail for local recipients. who processes those redirections? the Postfix local(8) delivery agent, obviously. and here's the thing bestie: this table is always searched with an email address localpart β€” no domain portion, periodt.

this is not like virtual(5) aliasing (virtual_alias_maps), which applies to all recipients: local(8), virtual, and remote, and which is implemented by the cleanup(8) daemon. that table is often searched with a full email address (domain included). different table, different vibe. iykyk.

normally, the aliases(5) table is specified as a text file that serves as input to the postalias(1) command. the result β€” an indexed file in dbm or db format β€” is what the mail system uses for fast lookup. so after you change the Postfix alias database, run the command newaliases to rebuild that indexed file. no cap. πŸ™Œ

when the table is provided via other means β€” think NIS, LDAP or SQL β€” the same lookups are done as for ordinary indexed files. same energy, different plumbing.

alternatively, the table can be provided as a regular-expression map, where patterns are given as regular expressions. in that case the lookups happen in a slightly different way, described below under "REGULAR EXPRESSION TABLES". πŸ‘€

also: users can control delivery of their own mail by setting up .forward files in their home directory. lines in per-user .forward files have the same syntax as the right-hand side of aliases(5) entries. cute, right?

the format of the alias database input file is as follows:

  • an alias definition has the form
name: value1, value2, ...
  • empty lines and whitespace-only lines are ignored, and so are lines whose first non-whitespace character is a #.
  • a logical line starts with non-whitespace text. a line that starts with whitespace continues a logical line.

the name is a local address (no domain part). use double quotes when the name contains any special characters such as whitespace, #, :, or @. and the name gets folded to lowercase, so that database lookups are case insensitive. slay. ✨

in addition, when an alias exists for owner-name, this will override the envelope sender address, so that delivery diagnostics get directed to owner-name instead of the originator of the message (for details, see owner_request_special, expand_owner_alias and reset_owner_alias). this is typically used to send delivery errors to the maintainer of a mailing list, who is in a way better position to deal with mailing list delivery problems than the originator of the undelivered mail. bestie is literally the main character of undelivered mail, the maintainer is the support group πŸ’€

the value contains one or more of the following:

  • address β€” mail is forwarded to address, which is compatible with the RFC 822 standard.
  • /file/name β€” mail is appended to /file/name. for details on how a file is written see the sections "EXTERNAL FILE DELIVERY" and "DELIVERY RIGHTS" in the local(8) documentation. delivery is not limited to regular files. for example, to dispose of unwanted mail, deflect it to /dev/null. iconic black hole behaviour.
  • |command β€” mail is piped into command. commands that contain special characters, such as whitespace, should be enclosed between double quotes. for details on how a command is executed see "EXTERNAL COMMAND DELIVERY" and "DELIVERY RIGHTS" in the local(8) documentation.

when the command fails, a limited amount of command output is mailed back to the sender. the file /usr/include/sysexits.h defines the expected exit status codes. for example, use "|exit 67" to simulate a "user unknown" error, and "|exit 0" to implement an expensive black hole. πŸ”₯

  • :include:/file/name β€” mail is sent to the destinations listed in the named file. lines in :include: files have the same syntax as the right-hand side of aliases(5) entries.

a destination can be any destination that is described in this manual page. however, delivery to "|command" and /file/name is disallowed by default. to enable, edit the allow_mail_to_commands and allow_mail_to_files configuration parameters.


πŸ¦‹ ADDRESS EXTENSION πŸ¦‹

when alias database search fails, and the recipient localpart contains the optional recipient delimiter (e.g., user+foo), the search is repeated for the unextended address (e.g., user).

the propagate_unmatched_extensions parameter controls whether an unmatched address extension (+foo) is propagated to the result of table lookup.


πŸŽ€ CASE FOLDING πŸŽ€

the local(8) delivery agent always folds the search string to lowercase before database lookup. every time. no exceptions. lowercase girlie through and through πŸ’…


🌈 REGULAR EXPRESSION TABLES 🌈

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 regexp_table(5) or pcre_table(5). NOTE: these formats do not use : at the end of a pattern.

each regular expression is applied to the entire search string. thus, a search string user+foo is not broken up into user and foo. it's one unit, bestie, no splitting.

regular expressions are applied in the order as specified in the table, until a regular expression is found that matches the search string.

lookup results are the same as with indexed file lookups. for security reasons there is no support for $1, $2 etc. substring interpolation.


πŸ‘‘ SECURITY πŸ‘‘

the local(8) delivery agent disallows regular expression substitution of $1 etc. in alias_maps, because that would open a security hole. do not do it. not even once.

the local(8) delivery agent will silently ignore requests to use the proxymap(8) server within alias_maps. instead it will open the table directly. before Postfix version 2.2, the local(8) delivery agent will terminate with a fatal error. so if you're on something ancient, heads up 😭


πŸ’œ CONFIGURATION PARAMETERS πŸ’œ

the following main.cf parameters are especially relevant. the text below provides only a parameter summary. see postconf(5) for more details including examples.

  • alias_database (see 'postconf -d' output) β€” the alias databases for local(8) delivery that are updated with "newaliases" or with "sendmail -bi".
  • alias_maps (see 'postconf -d' output) β€” optional lookup tables that are searched only with an email address localpart (no domain) and that apply only to local(8) recipients; this is unlike virtual_alias_maps that are often searched with a full email address (including domain) and that apply to all recipients: local(8), virtual, and remote.
  • allow_mail_to_commands (alias, forward) β€” restrict local(8) mail delivery to external commands.
  • allow_mail_to_files (alias, forward) β€” restrict local(8) mail delivery to external files.
  • expand_owner_alias (no) β€” when delivering to an alias "aliasname" that has an "owner-aliasname" companion alias, set the envelope sender address to the expansion of the "owner-aliasname" alias.
  • propagate_unmatched_extensions (canonical, virtual) β€” what address lookup tables copy an address extension from the lookup key to the lookup result.
  • owner_request_special (yes) β€” enable special treatment for owner-listname entries in the aliases(5) file, and don't split owner-listname and listname-request address localparts when the recipient_delimiter is set to "-".
  • recipient_delimiter (empty) β€” the set of characters that can separate an email address localpart, user name, or a .forward file name from its extension.

available in Postfix version 2.3 and later:

  • frozen_delivered_to (yes) β€” update the local(8) delivery agent's idea of the Delivered-To: address (see prepend_delivered_header) only once, at the start of a delivery attempt; do not update the Delivered-To: address while expanding aliases or .forward files.

⭐ STANDARDS ⭐

RFC 822 (ARPA Internet Text Messages)


🫢 SEE ALSO 🫢


πŸ“ README FILES πŸ“

use "postconf readme_directory" or "postconf html_directory" to locate this information.

  • DATABASE_README, Postfix lookup table overview

🧚 LICENSE 🧚

The Secure Mailer license must be distributed with this software.


πŸ’– AUTHOR(S) πŸ’–

Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA

Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA


okay that's the whole page, bestie, every single flag and default and warning intact πŸ’… and a lil sign-off for you: this was aliases(5) from the File Formats Manual β€” the Postfix local alias database format page. now go run newaliases and rebuild that indexed file like the main character you are ✨🌸

πŸ“¦ where this page comes from