procmail
[Top] [All Lists]

Re: Blocking attachments

2002-04-12 11:36:33
look out for a ready-to-use script named "sanitizer" which might be
exactely what you are looking for. (dont know the url, but should be easy to 
find)

petre


On Fri, Apr 12, 2002 at 02:05:53PM -0400, Kevin Ring wrote:
I need to be able to block unsafe attachments in e-mails that come in. I
have looked through the archives and found this from february. it doesn't
seem to work when I paste it in. I'd rather it go into a junk mailbox that I
have setup to trap spam, not to /dev/null, but that SHOULD be an easy fix.
Thanks for your help, I'm something of a neophyte with this stuff.


kevin

:

From: Sergiy Zhuk <serge(_at_)yahoo-inc(_dot_)com>
To: Takateru Ushiroda <taka(_at_)barnard(_dot_)edu>
Cc: procmail(_at_)informatik(_dot_)rwth-aachen(_dot_)de
Date: Thu, 01 Feb 2001 13:20:27 -0800 (PST)
Message-id: 
<Pine(_dot_)BSF(_dot_)3(_dot_)96(_dot_)SK(_dot_)1010201130941(_dot_)10501C-100000(_at_)serge(_dot_)yahoo(_dot_)com>

----------------------------------------------------------------------------
----

hi

On Thu, 1 Feb 2001, Takateru Ushiroda wrote:

I'd like to setup procmail to block file attachments with certain
extensions like .vbs, .shs, etc.  How would I do this.  I've checked out

here's a recipe, all credits go to Philip Guenther, I've just added
extensions I need to filter to his regexp.

# The regexp for matching whitespace in the embedded header field
# of a multipart message.  We have to handle wrapped lines.
ws = '[       ]*($[   ]+)*'

# The regexp for matching 'anything' inside an embedded header
# field of a multipart message.  That is, it matches anything
# except the newline (not followed by a whitespace character)
# that terminates the header field.
dotstar = '.*($[      ].*)*'

# A single double-quote.  For use in variable expanded regexps to
# avoid problems related to how procmail implements the variable
# expansion
dq = '"'

# Any condition that uses any of these variables in a its regexp
# must have the '$' special before the regexp to tell procmail to
# do variable expansion on the regexp.

# That matches if there exists a embedded Content-whatever header field
# whose value, ignoring legal whitespace, matches the regexp
#     .*name="filename"

ext = '\.(scr|vbs|shs|bat|com|exe|pif)'

:0 B
* $ ^Content-(Type|Disposition)*:${dotstar}name${ws}=${ws}${dq}.*${ext}${dq}
/dev/null

--
rgds,
serge

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

_______________________________________________
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>