限制部分Postfix用户只能内部收发的例子(完整版)
生活随笔
收集整理的這篇文章主要介紹了
限制部分Postfix用户只能内部收发的例子(完整版)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這里給出一個配置,僅供大家參考。
配置方法:
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:
引用:
??? foo@extmail.org local_in_only
??? bar@extmail.org local_in_only
4)編輯/etc/postifx/local_out_senders:
引用:
??? foo@extmail.org local_out_only
??? bar@extmail.org local_out_only
5)編輯/etc/postfix/local_domains:
引用:
??? internal.foo.com???????? OK
??? internal.bar.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
這樣就定義了extmail.org域名里兩個用戶foo和bar,只允許和internal.foo.com和internel.bar.com 兩個內部域的用戶來往郵件,對于外部的郵件則沒有收或發的能力。如果外部郵件企圖給這2個用戶發送,則遇到如下錯誤:
引用:
??? 554 5.7.1 <foo@extmail.org>: Recipient address rejected: Access denied
如果這2個內部用戶要給外部用戶發email,將遇到如下錯誤:
引用:
??? 554 5.7.1 <bar@extmail.org>: Sender address rejected: Access denied
目前這樣的配置就可以比較完整的實現內部用戶的功能需求了。其實這種配置的方法不難,關鍵得分清楚什么階段,調用什么restrictions即可。
配置方法:
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:
引用:
??? foo@extmail.org local_in_only
??? bar@extmail.org local_in_only
4)編輯/etc/postifx/local_out_senders:
引用:
??? foo@extmail.org local_out_only
??? bar@extmail.org local_out_only
5)編輯/etc/postfix/local_domains:
引用:
??? internal.foo.com???????? OK
??? internal.bar.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
這樣就定義了extmail.org域名里兩個用戶foo和bar,只允許和internal.foo.com和internel.bar.com 兩個內部域的用戶來往郵件,對于外部的郵件則沒有收或發的能力。如果外部郵件企圖給這2個用戶發送,則遇到如下錯誤:
引用:
??? 554 5.7.1 <foo@extmail.org>: Recipient address rejected: Access denied
如果這2個內部用戶要給外部用戶發email,將遇到如下錯誤:
引用:
??? 554 5.7.1 <bar@extmail.org>: Sender address rejected: Access denied
目前這樣的配置就可以比較完整的實現內部用戶的功能需求了。其實這種配置的方法不難,關鍵得分清楚什么階段,調用什么restrictions即可。
轉載于:https://blog.51cto.com/krishna/196812
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的限制部分Postfix用户只能内部收发的例子(完整版)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: AS400: 对象属性Domain和St
- 下一篇: 强大的DataGrid组件[13]_字段