LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Remove attachments with Procmail? (https://www.linuxquestions.org/questions/linux-security-4/remove-attachments-with-procmail-191270/)

ciop 06-08-2004 05:43 PM

Remove attachments with Procmail?
 
I have this very simple qustion but for which I haven't found an answer yet.

How can I write a procmail recipe that will deliver an email without it's attachment ?

I'm starting thinking it might not be possilble other ways than to make a copy of the message and forward it.
But than again ... how do I do that without copying the attachment too ?

Thank you.

plan9 06-08-2004 09:09 PM

I think that I may be able to help, as i've set up some crazy procmail stuff in the past. Please post your .procmailrc and any other related config scripts.

plan9

ciop 06-09-2004 02:48 AM

My procmailrc file look like this:


#LOGABSTRACT=all
VERBOSE=on

SPOOL=/var/spool/mail/
JUNK=$HOME/junk

PMDIR=/etc/spamm
LOGFILE=$HOME/log.procmail
INCLUDERC=$PMDIR/rc.spamm



The rc.spamm recipe file has the follwoing entries in which I'm most interested:

#Declarations...
# ANY = any character including newline
ANY='(.|$)'
# NAME = characters valid in a user or host name.
NAME=[a-z0-9_.-]


#The recipe...

:0B

* $ Content-type:$ANY+name=".+\.(bat|com|exe|hta|lnk|mdb|mus|pif|scr|vbs|wav)"

#Decision
{

:0 f

#And this one gives me headaches ...
| formail -i "Content-type: text/plain"

:0
$SPOOL

}



As you can see , I intend to keep the message , but without the attachment. Forwarding the message with its attachment as plain text in the body message ... is not good enough.

Is there some adjustment to what I've done , or some totaly different recipe that will just strip the attachment off the message ... so I can just place it in $SPOOL ?


Thanks again.

plan9 06-09-2004 03:11 PM

ciop,

I see that you appear to want to filter for common virus types. Wanting to kill the attachments, but still be able to check out the message. I have not done anything like that myself- my experience is limited to file servers and complex auto-responders.

I did some searching for you and found something that I think will work for you, it's called the E-mail Sanitizer, and it's web page can be found here:

http://www.impsec.org/email-tools/pr...-security.html

There is also a procmail email list that was very helpful to me when I was putting my proc stuff together, it can be found here:

http://www.procmail.org/era/lists.html

Also, at the link above, is SmartList, which may be of interest as well.

Sorry that I don't have a quick answer for you! Please let me know what you find out and how it is that you implement your rc script.

plan9


All times are GMT -5. The time now is 01:23 AM.