Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Archiving with postfix

15 views
Skip to first unread message

Jason Voorhees

unread,
May 12, 2011, 6:23:56 PM5/12/11
to
Hi people:

I pretend to have the best backup of all e-mail of my servers than run
Postfix and Cyrus/Dovecot. It would be simple for me to backup just
/var/spool/mail or /var/spool/imap every night but there are so many
people that use POP3, or simply deletes messages from their mailbox
while using IMAP.

So I thought that making a organized copy of all send/receipt e-mail
that went through postfix would be the best solution (for me at
least). I know I can achieve this archiving feature with MailScanner
but I want to avoid using that.

Do you know any method of create an archiving system using only
postfix (and maybe procmail, maildrop or other filters maybe but no
amavis)? I know there are commercial products to achieve this but I'm
looking for an open source solution first.

I hope someone can give me some ideas.

Thanks

Jeroen Geilman

unread,
May 12, 2011, 6:30:02 PM5/12/11
to
On 05/13/2011 12:23 AM, Jason Voorhees wrote:
> Hi people:
>
> I pretend to have the best backup of all e-mail of my servers than run
> Postfix and Cyrus/Dovecot. It would be simple for me to backup just
> /var/spool/mail or /var/spool/imap every night but there are so many
> people that use POP3, or simply deletes messages from their mailbox
> while using IMAP.
>
> So I thought that making a organized copy of all send/receipt e-mail
> that went through postfix would be the best solution (for me at
> least). I know I can achieve this archiving feature with MailScanner
> but I want to avoid using that.

Yes, please avoid using MailScanner.

> Do you know any method of create an archiving system using only
> postfix (and maybe procmail, maildrop or other filters maybe but no
> amavis)?

If you don't need to preserve the original envelope, always_bcc or
recipient_bcc_maps will to what you want.

If you do need to preserve the exact incoming message, use an smtp proxy
to do $whatever-you-want.


--
J.

Jason Voorhees

unread,
May 12, 2011, 6:47:04 PM5/12/11
to
> Yes, please avoid using MailScanner.

I never knew why postfix users apparently hate MailScanner. I know
that this question isn't the purpose of my thread but... Can I know
why you don't like MailScanner?

>
>> Do you know any method of create an archiving system using only
>> postfix (and maybe procmail, maildrop or other filters maybe but no
>> amavis)?
>
> If you don't need to preserve the original envelope, always_bcc or
> recipient_bcc_maps will to what you want.
>
> If you do need to preserve the exact incoming message, use an smtp proxy to
> do $whatever-you-want.
>

Ok, I'm not a postfix expert but could you give me some additional
explanation about a smtp proxy to do $whatever-i-want? Just give me
some tips so look up in google.

Jeroen Geilman

unread,
May 12, 2011, 6:56:09 PM5/12/11
to
On 05/13/2011 12:47 AM, Jason Voorhees wrote:
>> Yes, please avoid using MailScanner.
> I never knew why postfix users apparently hate MailScanner. I know
> that this question isn't the purpose of my thread but... Can I know
> why you don't like MailScanner?
>

MailScanner directly manipulates the postfix queue.
As documented, this is not supported - use it at your own risk.

>>> Do you know any method of create an archiving system using only
>>> postfix (and maybe procmail, maildrop or other filters maybe but no
>>> amavis)?
>> If you don't need to preserve the original envelope, always_bcc or
>> recipient_bcc_maps will to what you want.
>>
>> If you do need to preserve the exact incoming message, use an smtp proxy to
>> do $whatever-you-want.
>>
> Ok, I'm not a postfix expert but could you give me some additional
> explanation about a smtp proxy to do $whatever-i-want? Just give me
> some tips so look up in google.

I suggest the documentation, instead:

http://www.postfix.org/postconf.5.html#smtpd_proxy_filter

This can be anything that speaks SMTP.

(Note that implementing one of the *_bcc options will be far easier)

--
J.

Jason Voorhees

unread,
May 12, 2011, 7:01:20 PM5/12/11
to
> I suggest the documentation, instead:
>
> http://www.postfix.org/postconf.5.html#smtpd_proxy_filter
>

Thanks, I'm going to read it.

> This can be anything that speaks SMTP.
>
> (Note that implementing one of the *_bcc options will be far easier)
>

I'm not pretty sure how to do that because I don't want to bcc all my
e-mail to one address.

Jeroen Geilman

unread,
May 12, 2011, 7:12:06 PM5/12/11
to

The To: and From: addresses in the headers won't be changed; only the
envelope recipient.
Think "mailbox" instead of "address".

--
J.

Wietse Venema

unread,
May 12, 2011, 8:08:30 PM5/12/11
to
Jason Voorhees:

> > I suggest the documentation, instead:
> >
> > http://www.postfix.org/postconf.5.html#smtpd_proxy_filter
> >
>
> Thanks, I'm going to read it.
>
> > This can be anything that speaks SMTP.
> >
> > (Note that implementing one of the *_bcc options will be far easier)
> >
>
> I'm not pretty sure how to do that because I don't want to bcc all my
> e-mail to one address.

/etc/postfix/main.cf:
recipient_bcc_maps = pcre:/etc/postfix/recipient_pcre
recipient_delimiter = +

/etc/postfix/recipient_pcre:
# Send copy of mail for each us...@example.org recipient
# to archive+user=examp...@example.com
/^(.*)@([^@]+)$/ archive+$1=$2...@example.com

This sends a copy for each recipient to arc...@example.com, with
the original recipient encoded in the address extension.

This question comes up every few months or so.

Wietse

jeffrey j donovan

unread,
May 12, 2011, 9:11:20 PM5/12/11
to

sorry to thread jump
can the pcre map include multilines ? what Im looking at is a bcc to archive but ^not aliasu...@example.com does it read line by line or can in include an if $user=fred dev/null else /^......

/^!aliasusername@([^@]+)$/ archive+$1=$2...@example.com
/^(.*)@([^@]+)$/ archive+$1=$2...@example.com

or
/^aliasusername@([^@]+)$/ deny
/^(.*)@([^@]+)$/ archive+$1=$2...@example.com

-j

Stan Hoeppner

unread,
May 13, 2011, 1:16:13 AM5/13/11
to
On 5/12/2011 8:11 PM, jeffrey j donovan wrote:


> can in include an if $user=fred dev/null else /^......

http://linux.die.net/man/5/pcre_table

or simply execute

/$ man 5 pcre_table

--
Stan

Ralf Zimmermann

unread,
May 13, 2011, 4:24:28 AM5/13/11
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/13/2011 02:08 AM, Wietse Venema wrote:
> Jason Voorhees:
>>> I suggest the documentation, instead:
>>>
>>> http://www.postfix.org/postconf.5.html#smtpd_proxy_filter
>>>
>>
>> Thanks, I'm going to read it.
>>
>>> This can be anything that speaks SMTP.
>>>
>>> (Note that implementing one of the *_bcc options will be far easier)
>>>
>>
>> I'm not pretty sure how to do that because I don't want to bcc all my
>> e-mail to one address.
>
> /etc/postfix/main.cf:
> recipient_bcc_maps = pcre:/etc/postfix/recipient_pcre
> recipient_delimiter = +
>
> /etc/postfix/recipient_pcre:
> # Send copy of mail for each us...@example.org recipient
> # to archive+user=examp...@example.com
> /^(.*)@([^@]+)$/ archive+$1=$2...@example.com
>
> This sends a copy for each recipient to arc...@example.com, with
> the original recipient encoded in the address extension.
>
> This question comes up every few months or so.
>
> Wietse
>

How can I protect incoming Emails, when the IMAP Server use mailbox
autocreating for mailboxes doesn't exists?

Can I filter and REJECT incoming Emails where the email address contains
'+'? With mailbox autocreating everyone can mail to email addresses and
so autocreate folders.

Ralf

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJNzOq2AAoJENVjhbwuX+/H5QYIAKVAvDJv7iqQOMFxWnzIUd98
xdi4vxEFH68aqyN+FkkF2d03sVe61AsjzuRt+QOiyUQmM0YH2gdDutm4J5dbYZs9
l3k85KBuSp3zVv+4G1iSCIn/NufLmPAxZxxDYByEShej9QWAS9DhSzNkn0Ha6o/T
9gL1c0qB/u+W2ryR80RvEmBlt6ymYIquWyWPVvMT3cZi6ZWVnYdRSGicrNm09sRp
u0TB7CegIUvL+o0Zle8BHarRlDfs4zaf1xeFuxv3JZd19gknEwoNI+RG9Wx+k/Di
O9MzwXbbVKRSlCiEyGJAVIDyAcbK1sP5qakVNmyl7BrDKig2m7lCUuFb02yBnUc=
=g4eY
-----END PGP SIGNATURE-----

mouss

unread,
May 13, 2011, 4:28:05 AM5/13/11
to
Le 13/05/2011 03:11, jeffrey j donovan a écrit :

>
> On May 12, 2011, at 8:08 PM, Wietse Venema wrote:
>
>> Jason Voorhees:
>>>> I suggest the documentation, instead:
>>>>
>>>> http://www.postfix.org/postconf.5.html#smtpd_proxy_filter
>>>>
>>>
>>> Thanks, I'm going to read it.
>>>
>>>> This can be anything that speaks SMTP.
>>>>
>>>> (Note that implementing one of the *_bcc options will be far easier)
>>>>
>>>
>>> I'm not pretty sure how to do that because I don't want to bcc all my
>>> e-mail to one address.
>>
>> /etc/postfix/main.cf:
>> recipient_bcc_maps = pcre:/etc/postfix/recipient_pcre
>> recipient_delimiter = +
>>
>> /etc/postfix/recipient_pcre:
>> # Send copy of mail for each us...@example.org recipient
>> # to archive+user=examp...@example.com
>> /^(.*)@([^@]+)$/ archive+$1=$2...@example.com
>>
>> This sends a copy for each recipient to arc...@example.com, with
>> the original recipient encoded in the address extension.
>>
>> This question comes up every few months or so.
>>
>> Wietse
>>
> sorry to thread jump
> can the pcre map include multilines ? what Im looking at is a bcc to archive but ^not aliasu...@example.com does it read line by line or can in include an if $user=fred dev/null else /^......
>
> /^!aliasusername@([^@]+)$/ archive+$1=$2...@example.com
> /^(.*)@([^@]+)$/ archive+$1=$2...@example.com
>
> or
> /^aliasusername@([^@]+)$/ deny
> /^(.*)@([^@]+)$/ archive+$1=$2...@example.com
>

/^aliasusername@([^@]+)$/ aliasu...@discard.localhost
/^(.*)@([^@]+)$/ archive+$1=$2...@example.com

Then create a transport entry:
discard.localhost discard:

mouss

unread,
May 13, 2011, 4:34:19 AM5/13/11
to
Le 13/05/2011 10:24, Ralf Zimmermann a écrit :

> On 05/13/2011 02:08 AM, Wietse Venema wrote:
>> Jason Voorhees:
>>>> I suggest the documentation, instead:
>>>>
>>>> http://www.postfix.org/postconf.5.html#smtpd_proxy_filter
>>>>
>>>
>>> Thanks, I'm going to read it.
>>>
>>>> This can be anything that speaks SMTP.
>>>>
>>>> (Note that implementing one of the *_bcc options will be far easier)
>>>>
>>>
>>> I'm not pretty sure how to do that because I don't want to bcc all my
>>> e-mail to one address.
>
>> /etc/postfix/main.cf:
>> recipient_bcc_maps = pcre:/etc/postfix/recipient_pcre
>> recipient_delimiter = +
>
>> /etc/postfix/recipient_pcre:
>> # Send copy of mail for each us...@example.org recipient
>> # to archive+user=examp...@example.com
>> /^(.*)@([^@]+)$/ archive+$1=$2...@example.com
>
>> This sends a copy for each recipient to arc...@example.com, with
>> the original recipient encoded in the address extension.
>
>> This question comes up every few months or so.
>
>> Wietse
>
>
> How can I protect incoming Emails, when the IMAP Server use mailbox
> autocreating for mailboxes doesn't exists?
>
> Can I filter and REJECT incoming Emails where the email address contains
> '+'? With mailbox autocreating everyone can mail to email addresses and
> so autocreate folders.
>

that depends on
- whether you need delimiters in inbound mail
- why you need autocreation and which imap server you use


with dovecot, you can create two dovecot deliver transports, one with
autocreation enabled and the other with autocreation disabled. then use
transport_maps to select which one to use.

Charles Marcus

unread,
May 13, 2011, 7:40:44 AM5/13/11
to
On 2011-05-12 6:30 PM, Jeroen Geilman wrote:
> If you do need to preserve the exact incoming message, use an smtp proxy
> to do $whatever-you-want.

ASSP will accomplish this... and provide an excellent anti-spam service
at the same time, complete with scheduled *and* on-demand user
quarantine reports...

http://assp.sourceforge.net/

--

Best regards,

Charles

0 new messages