adding renattach to MailScanner+Postfix

Jonathan Higgins jhiggins at KENNESAW.EDU
Wed Apr 13 15:24:43 IST 2005

    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

I need to implement renaming extensions instead of just modifying the
subject, or blocking certain extensions(filenames) or filetypes.
software build:
  RHEL AS 3.0
  MailScanner 4.39.5
First thing I did was disable filename and filetype checking in
MailScanner.conf by adding a "#" infront of the rules.
#Filename Rules = %etc-dir%/filename.rules.conf
#Filetype Rules = %etc-dir%/filetype.rules.conf
Second thing, I installed renattach using the instructions for Postfix
Integration at
which, in short tells you to modify the postfix config file.
  filter    unix  -       n       n       -       -       pipe
        flags=q user=filter argv=renattach -p sendmail -i -f ${sender} --
   smtp      inet  n       -       n       -       -       smtpd
        -o content_filter=filter
This works for the most part, but here is where the problem starts to
creep up.
The postfix+MailScanner instructions at
tell me to add
  header_checks = regexp:/etc/postfix/header_checks
to /etc/postfix/
and create the file /etc/postfix/header_checks with the following
 /^Received:/ HOLD
Here is the problem:
When I send an email:
1.  Postfix puts the email into HOLD.
2.  MailScanner picks it up and does its thing.
3.  The content filter sends the email to renattach
4.  Renattach finishes with the email and reinjects it
5.  Reinjected email goes into HOLD.
6.  MailScanner picks it up and does its thing.
7.  Message is delivered.
Ok, if you don't see it, The email message is processed through
MailScanner 2x.
I took a look at
which shows how email moves around between all the processes that make up
There is a nice pretty picture that shows the content filter after the
qmgr.  I guess that's why they call it "After-Queue Content Filter"
The point being that after the queue, and after the content filter, the
email is reinjected using pickup and then eventually passed to cleanup,
which does another "header_check" and stuffs the email into the HOLD
queue again.
Some things I tried to fix this.
First fix attempt:
I tried to tell postfix to knock it off by modifying the as
  smtp      inet  n       -       n       -       -       smtpd
       -o content_filter=filter
       -o receive_override_options=no_header_body_checks
This didn't solve the problem, and to be honest, im not sure if its
effecting anything.
I did some more research under the advanced filter options for postfix,
with no help there.
Second fix attempt:
I had the thought that I could just modify the generic virus scanner and
fit renattach into MailScanner.
After creating a renattach-wrapper, modifying MailScanner.conf, and, I started running into weird errors, including the debug
message "can't find EOCD signature".
I had chopped up a few too many files, because after I cleaned out what I
thought I had just done, it was still fairly broken.  Im sure that was my
fault, so I cleaned everything out and rebuilt my MailScanner install
fresh, and got back to square one.
Ok, so what Im looking for is a solution to this problem.  It would be
beneficial to have the solution be part of MailScanner.  Im not married
to renattach, but it was one of the first programs out there that does
what I need.
Jonathan Higgins
IT R&D Project Manager
Kennesaw State University
jhiggins at
------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (
and the archives (

Support MailScanner development - buy the book off the website!

More information about the MailScanner mailing list