Hi Joy,
The new script can be found on this link;
Make sure that you add the -i flags on all grep commands
so that it will not miss uppercase characters.
http://www.ornl.gov/its/archives/mailing-lists/qmail/2001/03/msg01041.html
The script includes the instructions on how to use it. Please read it
carefully. You cannot use the script like what you are doing. e.g. using
it
together with condredirect. Just read the instructions.
If you want to redirect the mail just edit the checkhab script. it is
document in there.
cheers.
--
Noel G. Mistula
Network & Systems Administrator
Meriton Apartments Pty Ltd
Joy Hundley wrote:
>
> I'm completely new to qmail, and I've read the man pages on condredirect but
> I'm having no luck getting this to work. If someone could please enlighten
> me, I would be forever grateful.
>
> Facts: I'm running qmail 1.03 on a RH 7.0 box.
>
> Problem: I copied the following program into /var/qmail/bin/checkattach:
> ____________________________________________________________________________
> ___
> #!/bin/sh
> #
> # qmail -- checkattach
> # Author: Noel G. Mistula <[EMAIL PROTECTED]>
> # Date: 28 June 1999 Version: 0.1
> # I appreciate any comment to this quick and dirty way of filtering
> attachment.
> #
> # Modified: 7 July 1999 Version: 0.3
> # Modified: 7 May 2000 Version: 0.4
>
> # This is release under the GNU/GPL.
> # This is a very crude program. Use at your own risk.
> # This will bounce incoming email with executable,
> # video and other attachments. Just remove/add
> # whichever filetype (e.g. EXE, AVI, COM) is required.
> #
> # I use this in a user's .qmail file
> # by adding the line
> # |/usr/local/bin/checkattach
> # before the ./Maildir/
> #
> # Make sure to chmod 555 /usr/local/bin/checkattach
> # so that qmail users can execute it.
>
> # Start program here.
> ### This part is the new version (ver. 0.3)
> printmsg () {
> echo "The reason your email was rejected is you sent an attachment that can
> cause problems."
> echo "Sorry, the attachment you sent is in violation of our company's
> policy because it can cause problems like virus, or increase traffic load,
> or delete file(s) and/or among others."
> echo "Please disable HTML formatting when sending email because Visual
> Basic Script Worms/Virus normally exploits this."
> echo "--- Attachment filetype you sent is $ATTYPE"
> }
>
> #
> # Check for NOT allowed attachment.
> # Here you can include more filetype you want.
> #
> checktype () {
> case $ATTYPE in
> VBS | VBE | JSE | CSS | WSH | SCT | HTA | VXD | EXE | HTM |
> DOT | HLP | PAK | DAT | PCX | PPS | COM | BAT | CMD | AVI | MOV | RAM | OCX
> | CAB | SHS | CLA | RA | BMP | MPE | MPG | MP3 | MP4 | WAV | AUD | AU | DLL)
> printmsg $ATTYPE
> exit 100;;
> *)
> ;;
> esac
> }
>
> #ATTACHTYPE=`grep "filename=" - | gawk '{split($NF, results, ".");
> r=toupper(results[2]); print r}' | cut -c -3`
> ####Below doesn't work if more than 2 fields in name=
> #ATTACHTYPE=`grep "name=" - | gawk '{split($NF, results, ".");
> r=toupper(results[3]); print r}' | cut -c -3`
> #### End of ver. 0.3
>
> ####Below works OK
> ## This part is recently modified (7may2000) because I noticed that the gawk
> part in the
> ## ATTACHTYPE above, doesn't properly check when you have a filename like
> ## THIS.IS.A.VBS.VIRUS.txt.vbs
> ## The ATTACHTYPE below resolves this problem ;).
> ATTACHTYPE=`grep "name=" - | gawk 'BEGIN {FS="."}; {print toupper($NF)}' |
> cut -c -3`
> for ATTYPE in $ATTACHTYPE
> do
> checktype $ATTYPE
> done
> #### End of ver. 0.4
>
> exit 0
> ____________________________________________________________________________
> ________________________
>
> I then added a .qmail file with the following information in user's home
> directories:
> |condredirect [EMAIL PROTECTED] /var/qmail/bin/checkattach
> ./Maildir/
>
> My problem is that it is redirecting everything to the address to be
> forwarded to, not just the emails with attachments. What's up with this and
> why is it happening? Like I said -- I'm new to qmail and I've read the man
> pages and I'm just not having any luck with this. It is probably something
> very simple, and I would really appreciate it if someone could explain it to
> me.
>
> Joy Hundley