Procmail -> Anhang löschen

Postfix, QMail, Sendmail, Dovecot, Cyrus, Courier, Anti-Spam
luc
Posts: 53
Joined: 2003-11-11 07:51

Procmail -> Anhang löschen

Post by luc » 2005-03-22 09:24

Hallo,

ich habe mittlerweile einen Virus und einen Spam Scananner installiert. Beide sind in Procmail eingebunden. Ich setze verschiedene X-Status Informationen in den Header. Unteranderem bekommt eine Mail den X-Status: AI, wenn eine Anlage in der Mail gefunden wurde und diese Infiziert ist. Nun brauche ich den Befehl in procmail um eine Anlage komplett zu löschen, ohne das der Inhalt der Mail in Textform gelöscht wird. Also nur die Anlage löschen.
Wie mache ich das? In den Dokus und Howtos habe ich nur > /dev/null gefunden um die Komplette Mail zu löschen.

Jemand eine Idee?

mfg,
Luc

squize
Userprojekt
Userprojekt
Posts: 741
Joined: 2003-05-19 16:46
Location: Karlsruhe

Re: Procmail -> Anhang löschen

Post by squize » 2005-03-27 04:11

Ich denke, das sollte dein Problem lösen:

Von www.pc-tools.net/unix/renattach/
Filtering attachments out of email using renattach 1.2.1 with procmail on SuSE Openexchange Server 4


GET SOFTWARE
Download source file:
http://www.pc-tools.net/files/unix/rena ... 2.1.tar.gz

untar and install source:
tar -zxvf renattach-1.2.1.tar.gz
cd renattach-1.2.1
./configure

make
make install

This puts executable renattach in /usr/local/bin
and puts config file renattach.conf.ex in /usr/local/etc

Configure renattach.conf.ex to your liking and save as renattach.conf
************************************************************************************

CONFIGURE PROCMAIL

Our postfix main.cf does not include the line:
mailbox_command= /path/to/procmail
and that seems to be fine.

vi /etc/imap/procmailrc

at the bottom of the file but not before the last "sendmail" command add the lines(options -b=badlist mode -d=delete attachment)

:0 wf
| /usr/local/bin/renattach -b -d

save changes to /etc/imap/promailrc

postfix reload
(this was not necessary but did it just for giggles)
********************************************************************************************

CURRENT CONFIGURATION

In renattach.conf this is our current goodlist:
goodlist = DOC, PDF, RTF, SXC, SXW, TXT, ZIP

and badlist
badlist = ADE, ADP, BAS, BAT, CHM, CMD, COM, CPL, CRT, EML, EXE
badlist = HLP, HTA, HTM, INF, INS, ISP, JS, JSE, LNK, MDB
badlist = MDE, MSC, MSH, MSI, MSP, MST, NWS, OCX, PCD, PIF, REG
badlist = SCR, SCT, SHB, SHS, URL, VB, VBE, VBS, WSC, WSF, WSH

***********************************************************************************************

ERRORS

If the file is sent from inside the county to inside the county email server the email will be delivered after
renattach has deleted the attachment and attached a blankfile called originalname.bad

At this point if the file is sent from the outside it will be returned to sender with this message:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

mail@domain.tld
This message has been rejected because it has
a potentially executable attachment "the_message.scr"
This form of attachment has been used by
recent viruses or other malware.
If you meant to send this file then please
package it up as a zip file and resend it.
Gruss

Marc