backup every incoming mail to file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

backup every incoming mail to file

Leo-69
Hello,

we want to replace our current mail server (sendmail) with a new one
(postfix). For security reasons we want to make a backup of every
incoming mail (including envelope information) to the filesystem (simple
text file, e.g. mails_2008-07-01.txt, ...).

Current setup:
postfix + amavisd-new + clamav + spamassassin

Postfix receives mail for a virtual domain, delivers it through the
"content_filter" parameter to amavisd-new (clamav+spamassassin) and gets
it back from amavisd-new on a second smtpd daemon. This is the default
setup for amavisd-new.

Our problem is to save every mail BEFORE it will be filtered by
amavisd-new. Is there a possibility to do this? Or is the only way to
patch the amavisd-new source code?

Any help would be highly appreciated!

Kind regards,
Leo
Reply | Threaded
Open this post in threaded view
|

Re: backup every incoming mail to file

mouss-2
Leo wrote:

> Hello,
>
> we want to replace our current mail server (sendmail) with a new one
> (postfix). For security reasons we want to make a backup of every
> incoming mail (including envelope information) to the filesystem
> (simple text file, e.g. mails_2008-07-01.txt, ...).
>
> Current setup:
> postfix + amavisd-new + clamav + spamassassin
>
> Postfix receives mail for a virtual domain, delivers it through the
> "content_filter" parameter to amavisd-new (clamav+spamassassin) and
> gets it back from amavisd-new on a second smtpd daemon. This is the
> default setup for amavisd-new.
>
> Our problem is to save every mail BEFORE it will be filtered by
> amavisd-new.

why? why not configure your amavisd-new to pass all mail so that you can
do the copy AFER filtering. This is simpler and has the advantage of
putting the filter decison (amavisd-new and SA headers) in the archived
copy.

> Is there a possibility to do this? Or is the only way to patch the
> amavisd-new source code?

you can use recipient_bcc_maps with pcre: something like

/(.)/         $[hidden email]

but you need some care (think of enabled/disabled address rewrite,
loops, ... etc).

you may need to setup an additionnal smtpd (with its own cleanup
service) before amavisd-new.


Reply | Threaded
Open this post in threaded view
|

Re: backup every incoming mail to file

Magnus Bäck
On Tuesday, July 01, 2008 at 17:45 CEST,
     mouss <[hidden email]> wrote:

[...]

> you can use recipient_bcc_maps with pcre: something like
>
> /(.)/         $[hidden email]

ITYM

/(.*)/         $[hidden email]

[...]

--
Magnus Bäck
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: backup every incoming mail to file

Victor Duchovni
On Tue, Jul 01, 2008 at 10:26:47PM +0200, Magnus B?ck wrote:

> On Tuesday, July 01, 2008 at 17:45 CEST,
>      mouss <[hidden email]> wrote:
>
> [...]
>
> > you can use recipient_bcc_maps with pcre: something like
> >
> > /(.)/         $[hidden email]
>
> ITYM
>
> /(.*)/         $[hidden email]

This is fine with recipient_bcc_maps, where the lookup key is in "internal
form". If one wants to use similar rewriting with virtual alias maps,
one needs to be careful with quotes:

        if !/@example\.net$/
        /"(.*)"@example\.com$/ "${1}@example.com"@example.net
        /(.*)@example\.com$/ ${1}@[hidden email]
        endif

In this context (virtual_alias_maps), lookups are recursive, so it is
easy to get loops, make sure the RHS address is exempt from the rewrite.

--
        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:[hidden email]?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.