您的位置:首页 > 大数据 > 人工智能

Extmail/Postfix限制部分用户只能收发内部邮件

2013-12-18 08:35 453 查看
邮件服务器有时候在实现这样的需求,对不同级别的用户实现发邮件的范围控制.Postfix能够限制部分用户只能内部收发邮件,而不能与外部通信,外部域发不进来,限制人员的邮件也发不了外部域.原来的帖子:http://www.extmail.org/forum/viewthread.php?tid=6447&page=1这里实现的功能有些缺陷,对于限制的用户,其实只能对其外发(或者说rcpt to)做限制,而对于任意来信人给其发来的email则没有限制能力,真正的内部收发邮件用户,应该是只允许它和指定的内部域名(用户)联系,对于发向任何外部邮件域,或任意外部邮件域发来的邮件,都是禁止的。这里给出一个配置,仅供大家参考。
内部收发限制配置

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
目前这样的配置就可以比较完整的实现内部用户的功能需求了。其实这种配置的方法和之前的帖子道理一样,关键得分清楚什么阶段,调用什么restrictions即可。http://ydtpan.blog.163.com/blog/static/2998957320121029104556218/
另外如果不想用户使用web登陆邮箱,可以进入后面管理页面的用户功能设置里把webmail禁用就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: