OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: How to copy all incoming and outgoing messages

From: Victor Duchovni (Victor.Duchovnimorganstanley.com)
Date: Fri May 02 2008 - 12:37:46 CDT


On Fri, May 02, 2008 at 01:04:16PM -0400, Wietse Venema wrote:

> If we can agree on a usable MIME encapsulation, then it should be
> possible to spawn off a message in the cleanup server, after the
> Milter processing has happened, and before the (SMTP) client is
> notified that the mail transaction is complete.

This is a bit tricky, because the is not necessarily a "right" answer.

    - IMHO, The natural format for an archive message is a success DSN,
    with the original message attached in full (not just headers). Having
    the format defined by a standard is IMHO rather attractive.

    - Sendmail have for many years been supplying "copier" milter that
    is perhaps a defacto standard for such encapsulation. This is a
    multipart/mixed, with the envelope in the first part and the message
    in the second. The first part encodes the sender and recipients one
    per line as follows:

        --boundary
        Content-Type: text/plain
        Content-Transfer-Encoding: 7bit

        Attached is a copy of a message being sent by Sendmail Message Copier
        Sendmail Copier.
        via the proxy on <hostname.without.the.angle.brackets>.

        Original sender: senderexample.com
        Original recipient(s): rcpt1example.com
                               rcpt2example.net
                               rcpt3examplle.org

        Original message is attached.

        --boundary

    It would be far more natural to drop the verbiage and prefix each
    address with a type:

        Sender: <address>
        Recipient: <address>
        ...

    The second part is the attached message.

    - Microsoft Exchange has an archive format called
      Exchange Envelope Journalling. This too is not ideal, but is
      broadly implemented.

Any format we would choose would either be ugly (ad-hoc format from
existing vendor products) or Postfix-specific (at least initially).

The archive module for my 'tee' proxy punts the issue by using
format templates for the envelope part.

        --boundary
        Content-Type: text/plain
        Content-Transfer-Encoding: 7bit

        $topmatter
        `printf "$senderfmt", $sender`
        `printf "$1strcptfmt", $rcpt1`
        `printf "$nxtrcptfmt", $rcpt2`
        ...
        $footer

        --boundary

So I can generate the Sendmail compatible format without hard-coding
it.

This can generate any 2-part envelope/message encapsulation with some
stuff above the envelope, then the sender address in some form, then
the recipients with the 1st formatted differently if need be, a footer
and a separately attached message.

I also capture "ORCPT" values, but don't currently distinguish between
these and real recipients, because I don't accept "ORCPT" from outside,
rather ORCPT is the recipient just before my own virtual address
expansion. So capture of ORCPT would need to be optional and probably
deserves its own format template.

        $topmatter
        `printf "$senderfmt", $sender`
        `printf "$1strcptfmt", $rcpt1`
        [`printf "$orcptfmt", $orcpt1`]
        `printf "$nxtrcptfmt", $rcpt2`
        [`printf "$orcptfmt", $orcpt2`]
        ...
        $footer

With so much rope, is this still a reasonable Postfix feature?

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomopostfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.