廣告

2024 年 4 月
1234567
891011121314
15161718192021
22232425262728
2930  

彙整

限制POSTFIX轉寄到指定網域 與 針對特定使用者阻擋轉寄的網域

1.建立阻檔網域清單
[root@mail ~]# vi /etc/postfix/reject_domains
xxx.com.tw reject
存檔

2.建立資料庫
postmap hash:/etc/postfix/reject_domains

3.設定 main.cf
[root@mail ~]# vi /etc/postfix/main.cf
加在第一行
smtpd_recipient_restrictions =
     check_recipient_access hash:/etc/postfix/reject_domains,permit

4.重啟postfix 設定
[root@mail ~]#postfix reload

=======================================

針對特定使用者阻擋轉寄的網域

參考網址:http://ithelp.ithome.com.tw/question/10024729

可以透過 smtpd_restriction_classes 來實現
1. 將想受限制的使用者清單指定一個 smtpd_restriction_classes
vi reject_users

檢視原始檔複製到剪貼簿列印關於

  1. user1@mydomain.com reject_class   
  2. user2@mydomain.com reject_class 
user1@mydomain.com reject_class
user2@mydomain.com reject_class

postmap hash:/etc/postfix/reject_users

2. 將想受限制的 domain 清單也作一個 map

vi reject_domains

檢視原始檔複製到剪貼簿列印關於

  1. domain1.com reject   
  2. domain2.com reject 
domain1.com reject
domain2.com reject

postmap hash:/etc/postfix/reject_domains

3. 設定 postfix

vi main.cf

檢視原始檔複製到剪貼簿列印關於

  1. # 宣告 smtpd_restriction_classes 
  2. smtpd_restriction_classes = reject_class   
  3. # 說明這個 class 的檢查規則
  4. reject_class = check_recipient_access hash:/etc/postfix/reject_domain   
  5. # 現在要改用 check_sender_access 來檢查使用者了
  6. smtpd_recipient_restrictions =   
  7.         check_sender_access hash:/etc/postfix/reject_user,   
  8.         permit_mynetworks,   
  9.         ………………… 
# 宣告 smtpd_restriction_classes 
smtpd_restriction_classes = reject_class

# 說明這個 class 的檢查規則
reject_class = check_recipient_access hash:/etc/postfix/reject_domain

# 現在要改用 check_sender_access 來檢查使用者了
smtpd_recipient_restrictions =
        check_sender_access hash:/etc/postfix/reject_user,
        permit_mynetworks,
        .....................

4. 重啟 postfix, 測試

讀者也會看的其它文章:

    Comments are closed.