procmail
[Top] [All Lists]

Re: VirusSnag.rc - modify to clean & pass through

2004-02-19 15:28:39
On Thu, Feb 19, 2004 at 11:50:48AM -0800, Ken Douglass @pacbell.net
wrote:

My dream virussnag.rc would do this...

1) Insert my explanation in the body: "this email has been modified
because..."
2) followed by a copy of the headers
3) followed by only first 10 lines of original body

I don't know how to modify the virussnag.rc to do this. Does anyone
want to try this? I'm thinking my users would be impressed and really
appreciate the special care.

Glad you enjoy the plug-in.

The approach I would use would be via the NONDELIVER option that
the INCLUDERC understands.  It then sets a flag on finding a virus,
but otherwise send the message through.

After the INCLUDERC, you could have mores recipes including one
with a filtering ("f"-flag) action.  E.g.,


  DROPPRIVS  = yes   # see "man procmailrc" for why
  NONDELIVER = on    # do not deliver viruses to virus folder
  VIRUSMSG   = /path/to/virusmsg.txt
  INCLUDERC  = /path/to/virussnag.rc

  :0  # "$TRUE" was defined inside virussnag.rc, as was any applicable $VIR
  * $ TRUE ?? ^^$VIR_A$VIR_B$VIR_Z^^
  {
      :0 h  # this is an assignment recipe, not a delivering one
      HEADERS=| sed 's/^/> /'

      :0 b  #  this is an assignment recipe, not a delivering one
      TENBODY=| head -10 | sed 's/^/> /'

      :0 fwbi
      | cat $VIRUSMSG; echo "$HEADERS"; echo ">"; echo "$TENBODY"
  }

I just tested that, and it worked for me.  Here is what is in my
"virusmsg.txt":


 NOTICE FROM YOUR SYSADMIN OF ALTERED MESSAGE CONTENT:

 A suspicious attachment that our system believes to have been a virus
 was found in the original copy of this message and has been stripped
 from the copy being delivered.  Here are the full message headers and
 the first ten lines from the message body:


There is a blank line at the bottom of the text.

---
dman (Virus Snaggers currently at ver. 1.5.0, released 7 Feb 04)

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