procmail
[Top] [All Lists]

Re: Attachment Filtering

2002-04-16 07:56:03
On Mon, 2002-04-15 at 14:23, David W. Tamkin wrote:
Myles Williams wrote,

| I've just set up a global /etc/procmailrc file for filtering attachments
| of (exe,pif,com,vbs...etc).  I'm using formail to send an auto-reply
| notifying the sender that we do not allow attachments of this type.
| This is fine and dandy, and works precisely how I want it to.
|
| However, if the user sends his original message to 5 recipients, he will
| get the same amount of 'notification' messages send back to him. Is
| there a way to avoid this?

Not having root privileges anywhere, I cannot test this, but here's an idea.

Procmail has to be the LDA, and it must be setuid root.

Early in /etc/procmailrc, before you use DROPPRIVS, use a duplicate detection
recipe (see the man pages for examples) to see if the Message-Id: has come
through there before.  Since various users' mail will all have to share the
same cache file of Message IDs, this has to be done while procmail still has
root privileges; if all users have write access to the cache, someone will
find it and screw with it.

Well, users do not have login's on this particular server, so that
alleviates the permission issue.  Exim is also running as user 'mail',
with the procmail_pipe executing 'procmail -d $local_part' to run as the
specific user.  I could probably change this, but experimenting on a
live server is a little iffy.


If a message has a forbidden attachment type, test its ID against the cache.
If the ID is already in there, don't send the autoresponse.  If the ID was
not previously there (formail -D will add it), send it.  Just use a -f option
to $SENDMAIL so that it doesn't come from root (unless you want it to) ...
you might want to plug postmaster as its envelope sender and into its From:
header.

I managed to find this info in the manpages after you mentioned it here,
thanks.  However, in my scenario I can't have the 'formail -D' pipe at
the top of the procmailrc.  If it is at the top, a user can't send a
message to more than 1rcpt even if it doesn't have an attachment.  This
is because the message(with the same ID) is going through the procmailrc
over and over(depending on how many recipients).  The first person gets
the message, 'formail -D' add's the ID, and any subsequent messages are
dropped.

I fixed this by putting the 'formail -D' pipe in the { } after the file
attachment check.

The only thing I had to do to make sure users could access the
msgid.cache and log file was to chmod the permissions, but I think I'll
fix that with umask.

Thanks for your help.






_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

-- 
Myles Williams
Systems Administrator
Polaris Engineering Ltd. 
www.polariseng.com

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>