The Postfix mail server can use Content_filter to scan messages (viruses, ads, etc.) when receiving mail. By consolidating a centralized e-mail content filter, such as Amavis or Mailscanner, Postfix can use a single call for multiple scans. This is great, but some filters are difficult or almost impossible to integrate into a centralized filter. This is a problem, especially if your postfix system has installed some centralized Content_ Filter. Can we solve this problem, of course. This document will give you one of many possible solutions. Your steps may be different depending on your configuration.
In the case, we assume that we need a mail system that runs Postfix,amavis (including various plug-ins) and Avira mailgate. Postfix has been configured to use the Amavis system as a content_filter. MailGate cannot be consolidated through Amavis, so it uses a single content_filter.
Amavis configuration: Amavis listens on 10026 ports and forwards via 10027 ports.
The code is as follows |
Copy Code |
$inet _socket_port = 10026; Forward_method => ' smtp:[127.0.0.1]:10027 ';
|
MailGate configuration: MailGate listens on 20024 ports and forwards via 20025 ports.
The code is as follows |
Copy Code |
listenaddress localhost Port 20024 Forwardto Smtp:localhost Port 20025
|
Postfix need to configure two filters.
this can be done via a threaded filter: Incoming mail is first submitted to Postfix Content_filter, (Www.111cn.net then Content_ Filter passes the scanned message to the Postfix. The scanned message is then passed to the second content_filter. And finally to the user. Our chain is like this: Postfix > MailGate > Postfix > Amavisd-new >
The code is as follows |
Copy Code |
Postfix > User MAIN.CF: Content_filter = smtp:127.0.0.1:20024 Master.cf localhost:20025 inet n-n--SMTPD -O content_filter=smtp:127.0.0.1:10026 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= |
In this way, Postfix submits all incoming mail to port 20024 mailgate,mailgate and then passes the scan results back to 20025 Postfix.postfix running an additional SMTP service on port 20025. This service also contains a content_filter, so all messages reaching port 20025 will be passed to Port 10026. Amavis listens on port 10026, so the mail will be scanned by Aamavis. Amavis delivers mail to port 10027 after the scan is complete. Instead of running the SMTP service provided on port 10027, this message reaches the end of the chain, Mail will be mailed to the user. If you need more information on this topic, please email to robin.diederen@gmail.com. 111cn.net
Another example of a configuration may be as follows:
code is as follows |
copy code |
in MAIN.CF: # Send email to AMAVISD Content_filter = amavisd:[127.0.0.1]:10024 in master.cf: # AMAVISD Amav ISD Unix--n-2 lmtp -o lmtp_data_done_timeout=1200s -o disable_dns_lookups=yes # receive email from AMA VISD # and then send email to altermine 127.0.0.1:10025 inet n-n--smtpd -O content_filter=altermine p># receive email from 127.0.0.1:10025 Altermine Unix--n-2 pipe ... # receive email from altermine 127.0.0.1:20025 inet n-n--smtpd -o content_filter= -o ... |
The entire process is: postfix-> amavisd:[127.0.0.1]:10024-> postfix-> altermine-> postfix-> user