Chinaunix首页 | 论坛 | 博客
  • 博客访问: 291140
  • 博文数量: 49
  • 博客积分: 4776
  • 博客等级: 中校
  • 技术积分: 486
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-02 10:42
文章分类

全部博文(49)

文章存档

2010年(6)

2009年(8)

2008年(20)

2007年(10)

2006年(2)

2005年(3)

分类:

2008-03-14 09:02:22

限制部分用戶發送和接收外部郵件(已成功,大家分享)

  1) 編輯main.cf,在最後添加

smtpd_restriction_classes = local_only, local_only1
local_only = check_recipient_access hash:/etc/postfix/local_domains,reject
local_only1 = check_sender_access hash:/etc/postfix/local_domains,reject
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/local_senders,
check_recipient_access hash:/etc/postfix/local_recipients,
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
reject_rhsbl_sender,
reject_unknown_sender_domain,
reject_invalid_hostname
注:從第5行開始前面空一格.

2) 新增local-domains  ,  local_senders  ,  local_recipients
local_domains:
  domain.com OK
  192.168.0.1 OK
local_senders:
   local_only
local_recipients:
   local_only1

3) postmap hash:/etc/postfix/local_domains
postmap hash:/etc/postfix/local_senders
postmap hash:/etc/postfix/local_recipients

4) postfix reload
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:

local_in_only
local_in_only
4)编辑/etc/postifx/local_out_senders:

local_out_only
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
 
 
 
相关链接:
 
 
 
 
阅读(1872) | 评论(0) | 转发(0) |
0

上一篇:OutLook相关问题

下一篇:postfix相关问题

给主人留下些什么吧!~~