免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2494 | 回复: 3
打印 上一主题 下一主题

[Mail] 限制Postfix用户只能内部收发邮件的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-06 09:56 |只看该作者 |倒序浏览
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:

aa@aa.com local_in_only
bb@bb.com local_in_only
4)编辑/etc/postifx/local_out_senders:

aa@aa.com local_out_only
bb@bb.com local_out_only
5)编辑/etc/postfix/local_domains:

aa.com         OK
bb.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

修改完成后老报错.错误如下:
telnet 25端口后可以连上。但是什么都不显示
日志如下.
Dec  4 16:52:09 sv-005 postfix/master[13562]: daemon started -- version 2.4.5, configuration /etc/postfix
Dec  4 16:52:42 sv-005 postfix/smtpd[13572]: fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
Dec  4 16:52:43 sv-005 postfix/master[13562]: warning: process /usr/libexec/postfix/smtpd pid 13572 exit status 1
Dec  4 16:52:43 sv-005 postfix/master[13562]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

postconf -n的配置如下:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain =aaa.com
myhostname = mail.aaa.com
mynetworks = 192.168.1.0/24 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
relay_domains = $mydestination
sample_directory = /usr/share/doc/postfix-2.4.5/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 550

[ 本帖最后由 chaoneng 于 2007-12-6 09:59 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-12-06 12:53 |只看该作者
错误很简单
smtpd_recipient_restrictions的参数设置错误

fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit

感觉很奇怪的. 如果只能内网发邮件, 最简单的把防火墙对外端口关闭

如果内网都可以发, 那么
smtpd_recipient_restrictions = permit_mynetworks, reject
也就可以了, 不必什么check sender

论坛徽章:
0
3 [报告]
发表于 2007-12-06 14:32 |只看该作者
是这样的。我这样做限制是想有的用户可以发去外网。有的只能发到我指定的domain
smtpd_recipient_restrictions =
  check_sender_access hash:/etc/postfix/local_out_senders
  check_recipient_access hash:/etc/postfix/local_in_senders
我是看别人给出的文档.说可以这样。他们这样都成功了. 我为什么不能check local_out_senders和in 这2个文件?

论坛徽章:
0
4 [报告]
发表于 2007-12-07 12:53 |只看该作者
郁闷。。。。。。找不到解决方法
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP