access数据库文件可以被创建,以接受或拒绝来自选定域的邮件。例如,您可以选择拒绝来自已知垃圾邮件发送者的所有邮件,或者接受中继来自本地网络的所有邮件,因为现在使用 Sendmail 时,默认情况下会拒绝中继 -这是一项反垃圾邮件功能。在access下面的文件示例中,我们将允许从 localhost 和所有以 IP 地址开头的本地网络地址进行中继。192.168.1.
这些文件access和access.db对于本地或邻居客户端设置不是必需的。只有当您决定设置中央邮件枢纽来处理所有邮件时才需要。另请注意,使用中央邮件枢纽将提高运行 Sendmail 的网络上其他服务器和客户端的安全性和管理效率。
创建 access 文件 touch/etc/mail/access并添加以下行
# Description showing bellow for the format of this file comes from
# the Sendmail source distribution under "cf/README" file.
#
# The table itself uses e-mail addresses, domain names, and network
# numbers as keys. For example,
#
# spammer@aol.com REJECT
# cyberspammer.com REJECT
# 192.168.212 REJECT
#
# would refuse mail from spammer@aol.com, any user from cyberspammer.com
# (or any host within the cyberspammer.com domain), and any host on the
# 192.168.212.* network.
#
# The value part of the map can contain:
#
# OK Accept mail even if other rules in the
# running ruleset would reject it, for example,
# if the domain name is unresolvable.
# RELAY Accept mail addressed to the indicated domain or
# received from the indicated domain for relaying
# through your SMTP server. RELAY also serves as
# an implicit OK for the other checks.
# REJECT Reject the sender or recipient with a general
# purpose message.
# DISCARD Discard the message completely using the
# $#discard mailer. This only works for sender
# addresses (i.e., it indicates that you should
# discard anything received from the indicated
# domain).
# ### any text where ### is an RFC 821 compliant error code
# and "any text" is a message to return for
# the command.
#
# For example:
#
# cyberspammer.com 550 We don't accept mail from spammers
# okay.cyberspammer.com OK
# sendmail.org OK
# 128.32 RELAY
#
# would accept mail from okay.cyberspammer.com, but would reject mail
# from all other hosts at cyberspammer.com with the indicated message.
# It would allow accept mail from any hosts in the sendmail.org domain,
# and allow relaying for the 128.32.*.* network.
#
# You can also use the access database to block sender addresses based on
# the username portion of the address. For example:
#
# FREE.STEALTH.MAILER@ 550 Spam not accepted
#
# Note that you must include the @ after the username to signify that
# this database entry is for checking only the username portion of the
# sender address.
#
# If you use like we do in our "sendmail.mc macro configuration:
#
# FEATURE(`blacklist_recipients')
#
# then you can add entries to the map for local users, hosts in your
# domains, or addresses in your domain which should not receive mail:
#
# badlocaluser 550 Mailbox disabled for this username
# host.mydomain.com 550 That host does not accept mail
# user@otherhost.mydomain.com 550 Mailbox disabled for this recipient
#
# This would prevent a recipient of badlocaluser@mydomain.com, any
# user at host.mydomain.com, and the single address
# user@otherhost.mydomain.com from receiving mail. Enabling this
# feature will keep you from sending mails to all addresses that
# have an error message or REJECT as value part in the access map.
# Taking the example from above:
#
# spammer@aol.com REJECT
# cyberspammer.com REJECT
#
# Mail can't be sent to spammer@aol.com or anyone at cyberspammer.com.
#
# Now our configuration of access file,
# by default we allow relaying from localhost...
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
192.168.1 RELAY
|
: 不要忘记在这个文件中指定access您要中继的私有 IP 地址范围,否则您将无法从内部网络发送邮件。
创建 access.db 文件,记住,因为/etc/mail/access是一个数据库,在创建如上所述的文本文件之后,您必须使用 makemap 实用程序来创建数据库映射。要创建access 数据库映射,请使用以下命令
[root@deep] /# makemap hash /etc/mail/access.db < /etc/mail/access
|