In-transit mail scanning in Postfix can be achieved using the postfix mode of the Mail Scanner. To achieve this functionality, Postfix must be configured to use an external filter at a given address, and run another SMTP daemon that doesn't use the external filter. Postfix's default SMTP daemon will then send the messages to the external filter. The external filter then contacts the SMTP daemon that is not filter enabled and the message will resume its course.
An example of this type of configuration would be to run the Mail Scanner on port 10025 and the non-filter enabled SMTP on port 10026, as is described in the FILTER_README file in the Postfix distribution
First add this line to main.cf:
content_filter = smtp:[127.0.0.1]:10025
This will cause Postfix' default SMTP daemon to pipe all mail to the address 127.0.0.1:10025.
Then add these 3 entries to master.cf:
scan unix - - n - 10 smtp localhost:10026 inet n - n - 10 smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o myhostname=localhost.domain.tld -o smtpd_helo_restrictions= -o smtpd_client_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8 localhost:10025 inet n n n - 10 spawn user=nobody argv=/usr/local/f-prot/tools/scan-mail.pl -postfix 127.0.0.1:10026
The first entry specifies that Postfix's master service shall run at most 10 processes simultaneously to pipe the mail from the SMTP daemon to external filter. The second entry makes the master service run at most 10 smtpd processes simultaneously on address localhost:10026 to receive the mail from the filter, and configures it so it does not loop the mail back to the external filter. And the third entry makes the master service run at most 10 instances simultaneously of the Mail Scanner to filter the mail on address localhost:10025 and advises the Mail Scanner that the SMTP daemon it's supposed to relay SMTP connections to is running on address 127.0.0.1:10026.
Scan-mail.pl uses f-protd to do the actual virus scans. Make sure f-protd is running before starting the Mail Scanner.< Previous I Back to Index I Next >