Книга: Linux Network Administrator Guide, Second Edition

Managing Mail Aliases

Managing Mail Aliases

Mail aliases are a powerful feature that enable mail to be directed to mailboxes that are alternate names for users or processes on a destination host. For example, it is common practice to have feedback or comments relating to a World Wide Web server to be directed to "webmaster." Often there isn't a user known as "webmaster" on the target machine, instead it is an alias of another system user. Another common use of mail aliases is exploited by mailing list server programs in which an alias directs incoming messages to the list server program for handling.

The /etc/aliases file is where the aliases are stored. The sendmail program consults this file when determining how to handle an incoming mail message. If it finds an entry in this file matching the target user in the mail message, it redirects the message to wherever the entry describes.

Specifically there are three things that aliases allow to happen:

· They provide a shorthand or well-known name for mail to be addressed to in order to go to one or more persons.

· They can invoke a program with the mail message as the input to the program.

· They can send mail to a file.

All systems require aliases for Postmaster and MAILER-DAEMON to be RFC-compliant.

Always be extremely aware of security when defining aliases that invoke programs or write to programs, since sendmail generally runs with root permissions.

Details concerning mail aliases may be found in the aliases(5) manual page. A sample aliases file is shown in Example 18.4.

Example 18.4: Sample aliases File

#
# The following two aliases must be present to be RFC-compliant.
# It is important to resolve them to 'a person' who reads mail routinely.
#
postmaster:    root                            # required entry
MAILER-DAEMON: postmaster                      # required entry
#
#
# demonstrate the common types of aliases
#
usenet:        janet                           # alias for a person
admin:         joe,janet                       # alias for several people
newspak-users: :include:/usr/lib/lists/newspak # read recipients from file
changefeed:    |/usr/local/lib/gup             # alias that invokes program
complaints:    /var/log/complaints             # alias writes mail to file
#

Whenever you update the /etc/aliases file, be sure to run the command:

# /usr/bin/newaliases

to rebuild the database that sendmail uses internally. The /usr/bin/newaliases command is a symbolic link to the sendmail executable, and when invoked this way, behaves exactly as though it were invoked as:

# /usr/lib/sendmail -bi

The newaliases command is an alternative and more convenient way to do this.

Оглавление книги


Генерация: 1.162. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз