Daemon-Based Filtering
Daemon-based filtering offers a more advanced architecture over the command-based method with lower cost in I/O and CPU usage. It can provide better error handling than is possible with the command method. If implemented as a resident process, the startup overhead per message is eliminated. A daemon-based content filter can pass email messages back and forth with Postfix using the standard SMTP or LMTP protocol. Such a filter can run as a standalone daemon or it can be started by Postfix if configured to do so in master.cf.
In this configuration, we want the content filter to handle all
messages, whether delivered locally (via sendmail) or to the smtpd
daemon. You have to configure Postfix in
master.cf to use a special smtp
client component to deliver the messages
to your filter and an additional smtpd
daemon to receive messages back from
your filter. Figure 14-2
illustrates how a filtered message travels through Postfix to your
content filter and back into Postfix for delivery. In this diagram, the
filter receives mail via localhost port 10025 from the additional
smtp
client and submits it back to
Postfix via localhost port 10026 to the additional smtpd server component.
If the filter wants to reject a message, it should reply with an SMTP code of 550 along with the reason for the rejection. Otherwise, it should accept the message ...
Get Postfix: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.