Postfix配置邮箱只能内部收发 [ 网站地图 ]

发表于:2013-10-29 浏览:142 作者: 来源:互联网

关键字:postfix,邮箱配置

描述:1)在main.cf里定义如下的smtpd_restriction_classes:#restrictions smtpd_restriction_classes=local_out_onlylocal_in_only local_out_only=check_recipient_accesshash:/etc/postfix/local_domains,

1)在main.cf里定义如下的smtpd_restriction_classes:

# restrictions
smtpd_restriction_classes = local_out_only local_in_only
local_out_only = check_recipient_access hash:/etc/postfix/local_domains, reject
local_in_only = check_sender_access hash:/etc/postfix/local_domains, reject

2)将main.cf里的smtpd_recipient_restrctions定义为:

smtpd_recipient_restrictions =
check_sender_access hash:/etc/postfix/local_out_senders
check_recipient_access hash:/etc/postfix/local_in_senders
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname,

3)编辑/etc/postfix/local_in_senders:
引用:

foo@extmail.org local_in_only
bar@extmail.org local_in_only

4)编辑/etc/postifx/local_out_senders:

foo@extmail.org local_out_only
bar@extmail.org local_out_only

5)编辑/etc/postfix/local_domains:

internal.foo.com         OK
internal.bar.com         OK

6)为3,4,5建立对应的hash文件:

postmap hash:/etc/postfix/local_in_senders
postmap hash:/etc/postfix/local_out_senders
postmap hash:/etc/postfix/local_domains

这样就定义了extmail.org域名里两个用户foo和bar,只允许和internal.foo.com和internel.bar.com 两个内部域的用户来往邮件,对于外部的邮件则没有收或发的能力。如果外部邮件企图给这2个用户发送,则遇到如下错误:

554 5.7.1 <foo@extmail.org>: Recipient address rejected: Access denied

如果这2个内部用户要给外部用户发email,将遇到如下错误:

554 5.7.1 <bar@extmail.org>: Sender address rejected: Access denied


站长资讯网 做中国最丰富的资讯网站 沪ICP备05004089号