限制部分Postfix用户只能内部收发的例子(完整版)

来源:互联网 发布:国家数据统计库 编辑:程序博客网 时间:2024/05/07 06:31
原来的帖子:http://www.extmail.org/forum/viewthread.php?tid=524 这里实现的功能有些缺陷,对于限制的用户,其实只能对其外发(或者说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
7) 重启应用一下:
  postfix reload

注:每增加一行记录,就要重新postmap hash一下,再postfix reload才能生效。
    如果不需要控制外面发进来的,就把check_recipient_access hash:/etc/postfix/local_in_senders
    前面加个#号注释掉

这样就定义了 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://www.extmail.org/forum/thread-6447-1-1.html
阅读(205) | 评论(0) | 转发(0) |
0

上一篇:CVS SVN VSS 使用对比[二]

下一篇:特别记录:RAID5坏三颗硬盘

相关热门文章
  • ARM学习笔记--通用异步收发...
  • 用PHP输出LDAP查询结果
  • 金笛JDMAIL 部署某大型集团分...
  • 金笛短信设备在公安系统的应用...
  • 让你提升命令行效率的 Bash 快...
  • linux 常见服务端口
  • 【ROOTFS搭建】busybox的httpd...
  • 什么是shell
  • linux socket的bug??
  • linux的线程是否受到了保护?...
  • IBM DS3400 盘阵怎么查看是单...
  • 启动auditd时,报错如下,怎么...
  • CGSL系统中root密码正确,但无...
  • 在CGSL系统中,如何为不同的用...
  • CGSL系统如何设置交换分区的大...
给主人留下些什么吧!~~
评论热议
0 0