1. 程式人生 > >postfix 指定使用者限制指定域名收發

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 指定的域下的郵件了