Книга: Fedora™ Unleashed, 2008 edition

Rejecting Email from Specified Sites

Rejecting Email from Specified Sites

You read earlier in this chapter that you must be careful with mail relaying to avoid becoming a spam magnet. But what do you do if you are having problems with a certain site sending you spam? You can use the /etc/mail/access file to automatically reject mail from certain sites.

You can use several rules in the access file. Table 21.1 lists these rules.

TABLE 21.1 The Various Possible Options for Access Rules

Option Action
OK Accepts mail from this site, overriding any rules that would reject mail from this site.
RELAY Allows this domain to relay through the server.
REJECT Rejects mail from this site and sends a canned error message.
DISCARD Simply discards any message received from the site.
ERROR: "n message" Sends an error message back to the originating server, where n is an RFC 821-compliant error code number. The message itself can be anything you want.

The following is an example of three rules used to control access to a Sendmail account. The first rejects messages from spam.com. The second rejects messages from lamer.com and displays an error message to that site. The third allows mail from the specific host user5.lamer.com, even though there is a rule that rejects mail from the site lamer.com.

NOTE

For a more personal example of why you would bother to do this, I find that I get a lot of spam from the Hotmail domain, so I would just as soon reject it all. However, my wife uses a Hotmail account for her mail. If I did not allow her mail through, that would be a problem for me.

spam.com        REJECT
lamer.com       ERROR: "550 Mail from spammers is not accepted at this site."
user5.lamer.com OK

Open the /etc/access file, enter the rules of your choice, and then restart Sendmail so that your changes to the access file take effect. That can be done with

# service sendmail restart

or any of the other ways discussed in Chapter 11, "Automating Tasks."

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


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