Menu

Home

P

What is here?

=proxy_archiver= is a pass-through proxy that archives the data that passes through it. The special handling for SMTP is that envelope data (input before the DATA token) can be archived with special handling.

=archiver.pl= is an archiver that reads an entire file from standard input, archives it and then invokes the subordinate command with standard input connected to the archived file.

=filer.pl= is a script that can be run over archived files, such as collected by proxy_archiver and archiver.pl. It will move archived files to a hierarchy of directories that are separated by year, month and day.

How Can This Be Used?

Messages can be archived at a number of points, depending on the MTA, but a complete view of the messages that transit the MTA can be assembled if all messages that leave the MTA are archived. This can involve two types of archiving: archiving as the content is processed, or archiving as the content is delivered.

proxy_archiver

proxy_archiver archives content as it is processed.

A common method for postfix is to have a content filter that postfix connects to over local TCP/IP. This can be spamassassin and/or some virus scanning software such as clamav. After the filter has been applied, the filter usually reinjects the filtered message back into postfix via local-only TCP/IP.

Let's say that main.cf has a line in it

content_filter = scan:[127.0.0.1]:10025 

and master.cf configures the scan service as

scan unix - - n - 16 smtp -o smtp_send_xforward_command = yes

where the program listening on port 10025 is configured to reinject the message using port 10026, which is configured in master.cf with the following service line:

127.0.0.1:10026 inet n - n - 16 smtpd -o content_filter = -o smtpd_authorized_xforward_hosts = 127.0.0.0/8

We can reconfigure the program listening on port 10025 to forward its contents to port 10027 and have the proxy_archiver listen on that port. If it's configured to connect to port 10026, then it's an almost drop-in replacement.

The configuration for proxy_archiver to listen on port 10027 and send its output to port 10026 is done with the command line

proxy_archiver -l 127.0.0.1:10027 -s 127.0.0.1:10026.

That's it!

archiver.pl

archiver.pl archives messages as they are delivered.

Delivery agents usually take their input from standard input, with the recipient specified by command line options. archiver.pl allows for the specification of the complete command line, as well as two tags to apply to the archived file.

For example, a postfix mailbox command might look like

mailbox_command = deliver_mail "$USER"

which might specify that mail is to be delivered to the user in the USER environment variable from postfix. If the mailbox command is changed to

mailbox_command = archiver.pl x "$USER" deliver_mail "$USER"

then the contents are archived with file name tags, x and the user it was delivered to, and then that file is used as standard input to the command to perform the actual delivery.