原文:http://blog.chinaunix.net/u/16340/showart_1895391.html
配置方法:
1)在main.cf里定义如下的smtpd_restriction_classes:
QUOTE:
# 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定义为:
QUOTE:
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:
QUOTE:
foo@extmail.org local_in_only
bar@extmail.org local_in_only
4)编辑/etc/postifx/local_out_senders:
QUOTE:
foo@extmail.org local_out_only
bar@extmail.org local_out_only
5)编辑/etc/postfix/local_domains:
QUOTE:
internal.foo.com OK
internal.bar.com OK
6)为3,4,5建立对应的hash文件:
QUOTE:
# 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个用户发送,则遇到如下错误:
QUOTE:
554 5.7.1 <foo@extmail.org>: Recipient address rejected: Access denied
如果这2个内部用户要给外部用户发email,将遇到如下错误:
QUOTE:
554 5.7.1 <bar@extmail.org>: Sender address rejected: Access denied
目前这样的配置就可以比较完整的实现内部用户的功能需求了。其实这种配置的方法和之前的帖子道理一样,关键得分清楚什么阶段,调用什么restrictions即可。
限制部分Postfix用户只能内部收发的例子
Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
前往
- 公告/注意事项
- ↳ 新闻和通知
- ↳ 软件推荐
- 系统安装
- ↳ 教学和常见问答
- ↳ 系统安装和升级
- ↳ 启动和引导
- ↳ 网卡无线拨号
- ↳ 硬件与内核
- ↳ 笔记本及便携设备
- ↳ Ubuntu衍生版
- ↳ 其他类Unix OS发行版
- ↳ Debian发行版
- 配置美化
- ↳ 中文显示和输入法
- ↳ 个人配置文件存放点
- ↳ 软件文档翻译
- ↳ 窗口管理器及美化
- ↳ 桌面展示
- 软件使用
- ↳ 办公、图像、机械电子设计等
- ↳ Vim和Emacs
- ↳ 开源模板库
- ↳ 互联网相关软件
- ↳ 影音多媒体
- ↳ 游戏和模拟器
- ↳ 虚拟机和虚拟化
- ↳ Wine及其分支
- ↳ 其它类软件
- 服务器管理
- ↳ 服务器运维
- ↳ 云计算和容器(K8S/KVM/Docker/WSL等)
- ↳ Ubuntu VPS
- 程序设计与开发
- ↳ Shell脚本
- ↳ 软件/网站开发
- ↳ 内核及嵌入式开发
- ↳ Ubuntu编译和打包
- ↳ 开源小工具
- ↳ 挑战任务
- 感想与交流
- ↳ 深度PK版
- ↳ Ubuntu故事和感慨
- ↳ 同城交流
- ↳ 校园社团
- ↳ 港澳台校区
- ↳ 国外校区
- 站务区
- ↳ 论坛管理
- ↳ Ubuntu中文网上商店