已有 Postfix + Amavisd,需再加入無法整合至 Amavisd 的 Avira MailGate,採用「串接過濾器」架構:
Postfix(25) → MailGate(20024) → Postfix(20025) → Amavisd(10026) → Postfix(10027) → User
| 服務 | 接收埠 | 轉發埠 |
|---|---|---|
| Amavisd | 10026 | 10027 |
| MailGate | 20024 | 20025 |
content_filter = smtp:127.0.0.1:20024
# 1. MailGate 掃描後回郵至此埠
localhost:20025 inet n - n - - smtpd
-o content_filter=smtp:127.0.0.1:10026
# 2. Amavisd 掃描後回郵至此埠,直接遞送給用戶
127.0.0.1:10027 inet n - n - - smtpd
-o content_filter=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o smtpd_restriction_classes=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
-o local_header_rewrite_clients=
main.cf:
content_filter = amavisd:[127.0.0.1]:10024
master.cf:
amavisd unix - - n - 2 lmtp
-o lmtp_data_done_timeout=1200s
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=altermine
altermine unix - - n - 2 pipe
...
127.0.0.1:20025 inet n - n - - smtpd
-o content_filter=
-o ...
流向:postfix → amavisd → postfix → altermine → postfix → user
smtpd 實例,並透過 -o content_filter= 指定下一級過濾器或關閉過濾。mynetworks=127.0.0.0/8 確保內部轉發不被拒收。smtpd_*_error_limit 避免大量郵件導致暫時拒收。