RE: [courier-users] Filtering messages

This is a discussion on RE: [courier-users] Filtering messages within the Courier-Imap forums, part of the Mail Servers and Related category; Lucio [lcml@pixel.it] wrote: > Alessandro Vesely wrote: > > Courier already has a big-brother option. > > ...


Go Back   Usenet Forums > Mail Servers and Related > Courier-Imap

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2005
Julian Mehnle
 
Posts: n/a
Default RE: [courier-users] Filtering messages

Lucio [lcml@pixel.it] wrote:
> Alessandro Vesely wrote:
> > Courier already has a big-brother option.

>
> Yes, I know. But I need the users to be aware of the fact that their
> messages are being sniffed, so I have to force them to send CCs of
> thier messages to the big-brother address.


When I read your first message, I decided not to write a reply as I didn't
want to encourage eavesdropping. But now that you explained that you
explicitly _want_ your users to be aware of it, I think this is something
I can justify helping you with.

So let's see what you can do.

> I need to set up a filter that:
> 1 - Rejects all outgoing messages if they do not specify
> "bigbrother@localdomain" in one of the headers.
> 2 - Forward a copy of all incoming messages to
> "bigbrother@localdomain" if it doesn't already appears in one of the
> headers, and adds that address in the CC list of the message.
> [...]
> Is it possible to achieve that with the built-in big-brother option?


No.

In order to accomplish item 1, you need to use a courierfilter[1] (AKA
global mail filter), which is essentially a little daemon which listens
for connections on a Unix domain socket. Writing your own courierfilter
in C shouldn't be too difficult, but note that there are already two
modular filter frameworks that make writing filter modules _very_ easy:
Courier::Filter[2] for Perl, and pythonfilter[3] for Python. I don't
think Java is a good choice -- although writing a working courierfilter
daemon should be possible, its performance probably wouldn't even be
anything near that of Perl, not to mention native compiled code.

Your filter (or filter module, if you decide to use one of the modular
frameworks) would need to check the list of envelope recipients (the
headers aren't exactly authoritative as far as actual message delivery is
concerned) for the copy address, and then either return an "accept" or
"reject" result.

Be aware that courierfilters (global mail filters) cannot modify the
message. Besides, adding a "CC:" header wouldn't get the message
delivered to the copy address anyway because it's the envelope recipients
that count (although mail clients usually derive the envelope recipients
from the headers when submitting mail).

It should be possible to add the copy address to the list of envelope
recipients from within a courierfilter. This can be achieved by opening
the control file in append mode and appending an additional "r" control
record[4] with the copy address. However, I'm not entirely sure this
would actually cause Courier to deliver the message to the added copy
address. (Perhaps someone on this mailing list knows better than I do?)

> Someone told me I'm just using the wrong SMTP and that Postfix would be
> the right choiche; they also told me that even courier developers
> discourage using it as SMTP: is that true?


Obviously this is nonsense. It is interesting however which marketing
methods the Postfix people feel a need to resort to. ;-)

References:
1. http://www.courier-mta.org/courierfilter.html
2. http://search.cpan.org/dist/Courier-Filter
3. http://phantom.dragonsdawn.net/~gord...-pythonfilter/
4. http://www.courier-mta.org/queue.html



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/.../courier-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0