postfix 邮箱服务器 - 指定用户限制指定域名收发

main.cf 配置示例:

smtpd_restriction_classes = local_in_only, local_out_only
local_in_only = check_recipient_access hash:/etc/postfix/local_domains, reject
local_out_only = 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_accept_domain
        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
      reject_rhsbl_sender,
      reject_unknown_sender_domain,

 编辑创建限制文件:

~etc/postfix/local_domains
# 限制可以接收的指定域
~etc/postfix/local_senders
# 限制指定用户发送到 指定的域
~/etc/postfix/local_recipients
# 限制 指定用户接收 指定域的邮件

 

postmap 加载生产 db 数据:

# postmap hash:/etc/postfix/local_domains
# postmap hash:/etc/postfix/local_recipients
# postmap hash:/etc/postfix/local_senders

 

重启 postfix

如此便能可以只接收 local_domains 指定的域下的邮件了

 

posted @ 2019-01-04 20:21  01234567  阅读(1213)  评论(0编辑  收藏  举报