From: Atte Peltomaki (no email)
Date: Thu Jun 09 2005 - 08:29:23 EDT
> > > comes from an external program. I might as well explain the whole
> > > situation; we need to have all incoming mail tagged with a unique
> > > header, and idea was to do TIMESTAMP-RANDOMSUFFIX type header. I can
> > > easily make eg. python script to produce the header, but glueing it to
> > > postfix is wholly other matter. Also, python is quite slow for this so
> > > perhaps I need to do it in C.
> >
> > Just use a bog standard shell script, along the lines of:
> >
> > http://www.postfix.org/FILTER_README.html
> >
> > and use ed to insert any required headers. All you require is already on
> > your system.
>
> After careful consideration, this seems to be by far the easiest way to
> do it. Thanks a bunch to everyone who helped!
This is how I ended up doing it:
In the filter script, where the mail is shoveled in, I pipe it to
maildrop in this fashion:
cat mail | maildrop -A "`gen_hdr.py`" ./.mailfilter | $SENDMAIL BLAA
and .mailfilter:
to "|/bin/cat"
The -A option appends the header, and my python script generates it.
Maildrop conf file setup then to send stuff back through stdout.
Overhead from the whole procedure is somewhere around 0.020 and 0.050
seconds, which I think is bearable for a low-traffic server. Re-writing
the header generation in C with proper optimization would improve this
setup even further, but I see no point for my purposes.
This turned out to be really simple to implement. :-) Thanks again
everyone!
--
____________
\ ______// Atte Peltomäki -
\ \\____ IT Engineer - IT Server Team
\ __// F-Secure Corp. PL 24, FIN-00181 Helsinki, Finland
\ \\ Tel: +358 9 2520 0700, direct: +358 9 2520 5423
\ // http://www.F-Secure.com
\/ Integrated Solutions for Enterprise Security
|
|
|