18 messages in net.sourceforge.lists.courier-users[courier-users] RE: Minor flaw in cou...
FromSent OnAttachments
Lloyd ZusmanFeb 7, 2004 5:41 pm 
Lloyd ZusmanFeb 8, 2004 12:36 pm 
Julian MehnleFeb 9, 2004 1:51 am 
Lloyd ZusmanFeb 9, 2004 3:20 am 
Anand BuddhdevFeb 10, 2004 6:57 am 
Lloyd ZusmanFeb 10, 2004 7:25 am 
Julian MehnleFeb 10, 2004 7:39 am 
Anand BuddhdevFeb 10, 2004 7:50 am 
Anand BuddhdevFeb 10, 2004 8:11 am 
Anand BuddhdevFeb 10, 2004 8:37 am 
Lloyd ZusmanFeb 10, 2004 9:25 am 
Lloyd ZusmanFeb 10, 2004 9:40 am 
Sam VarshavchikFeb 10, 2004 3:24 pm 
Sam VarshavchikFeb 10, 2004 3:25 pm 
Lloyd ZusmanFeb 10, 2004 4:10 pm 
Mitch (WebCob)Feb 10, 2004 5:06 pm 
Mitch (WebCob)Feb 10, 2004 5:19 pm 
Alessandro VeselyFeb 11, 2004 6:42 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[courier-users] RE: Minor flaw in courierfilter implementation of SPFActions...
From:Julian Mehnle (lis@mehnle.net)
Date:Feb 9, 2004 1:51:39 am
List:net.sourceforge.lists.courier-users

Lloyd Zusman [lj@asfast.com] wrote:

Lloyd Zusman <lj@asfast.com> writes:

I just realized that there is a minor flaw in the courierfilter implementation of SPF.

It's actually a limitation in Courier's courierfilter interface.

But as far as I know, it's not possible to add a header to an email message from within a courierfilter module, [ ... ]

Yes.

Also, I'm hoping that there's some sort of hack^H^H^H^Htrick to get this behavior that doesn't involve changing the Courier source code.

I just thought of a possible hack to handle this case. What do you folks think of this idea? ...

I create a directory called, for example, /var/messageids. In the SPF courier-pythonfilter, if the message is not rejected, create a file in /var/messageids whose name is the Message-ID of the currently processed message. In this file, write the extra header(s) before returning '' or '200 Ok' from the filter step.

Then, very early in the subsequent maildrop step (which is set up for all mail passing through my system), pipe each message through a program which reads its message ID, and if a file with that name exists in /var/messageids, appends any headers in this file to the message. This message will then be processed by any other maildrop rules that might exist.

That header-appending program will delete the file in /var/messageids after adding the headers, and also, a cron-based cleanup script can periodically delete old files from /var/messageids.

The advantage of this is that the SPF testing takes place during the SMTP dialog, and the headers are added a bit later, before any further rules are processed.

How does this sound?

This is roughly what I'm planning to do in the *second* release of my
Courier::Filter filter module framework, the *first* release of which I will
finally release this week. I haven't decided yet what kind of modifications to
allow (just adding headers, or replacing the whole header, or even replacing the
whole message), and how to store the modification information (separate files,
DBM database file, whatever). But I, too, think this is the best we can do to
work around the limitation in the courierfilter interface.