当前位置: 主页 > 服务器技术 > Mail服务器 > Postfix限制部分用户发送和接收外部邮件

Postfix限制部分用户发送和接收外部邮件

时间:2009-10-12来源:互联网 点击:
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
注1:從第5行開始前面空一格.
2) 新增local-domains  ,  local_senders  ,  local_recipients三个文件
local_domains文件内容为:
  domain.com OK
  192.168.0.1 OK
local_senders文件内容为:
  kently@domain.com local_only
local_recipients文件内容为:
  kently@domain.com local_only1
3) postmap hash:/etc/postfix/local_domains
   postmap hash:/etc/postfix/local_senders
   postmap hash:/etc/postfix/local_recipients
4) postfix reload




注2:以后需要经常添加mial地址的时候可以使用以下脚本

#sh
email=kently
#要修改Email,就只用修改这个变量值。
echo "$email@AA.com local_only" >> /etc/postfix/local_senders
echo "$email@AA.com local_only1" >> /etc/postfix/local_recipients
#创建文件
postmap hash:/etc/postfix/local_domains
postmap hash:/etc/postfix/local_senders
postmap hash:/etc/postfix/local_recipients
#postfix查询数据库
postfix reload
#加载配置
注3:删除
sed ‘s/dd@aa/456/g‘ /etc/postfix/local_senders > /etc/postfix/local_senders.new
mv -f /etc/postfix/local_senders.new /etc/postfix/local_senders
sed ‘s/dd@aa/456/g‘ /etc/postfix/local_recipients > /etc/postfix/local_recipients.new
mv -f /etc/postfix/local_recipients.new /etc/postfix/local_recipients
postmap hash:/etc/postfix/local_domains
postmap hash:/etc/postfix/local_senders
postmap hash:/etc/postfix/local_recipients
postfix reload
站长资讯网
. TAG: POSTFIX 邮件 用户
推荐内容最近更新人气排行
关于我们 | 友情链接 | 网址推荐 | 常用资讯 | 网站地图 | RSS | 留言