OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Question about a simple filter

From: mouss (mlist.onlyfree.fr)
Date: Fri Jan 18 2008 - 10:42:01 CST


Val Polyakov wrote:
> I followed this:
> http://www.postfix.org/FILTER_README.html#simple_filter
>
> I added this to my master.cf :
>
> filter unix - n n - 10 pipe
> flags=Rq user=filter argv=/usr/bin/filter.sh -f ${sender} -- ${recipient}
>
>
>
> My filter.sh is as follows:
>
> ----------------------
> #!/bin/sh
>
> INSPECT_DIR=/var/spool/filter
> SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.
>
> EX_TEMPFAIL=75
> EX_UNAVAILABLE=69
>
> #trap "rm -f in.$$"13 15
>
> cd $INSPECT_DIR || {
> echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }
>
> cat >in.$$ || {
> echo Cannot save mail to file; exit $EX_TEMPFAIL; }
>
> /usr/bin/mail.pl in.$$ <in.$$ || { echo Message content rejected; exit
> $EX_UNAVAILABLE; }
>
> $SENDMAIL "$" <in.$$
>
> exit $?
> ----------------------
> I commented out the trap for debugging purposes, I wanted to see if it
> actually copies the mail, etc.
>
>
> Anyway
>
> If I run this by hand, as follows:
>
> /usr/bin/filter.sh -f rootval.vmsinfo.com -- vxpval.vmsinfo.com
> < /home/vxp/test.txt
>
> the email gets processed by my mail.pl script, and delivered to the mailbox
>
> However, if I do not run this by hand (ie, simply send the email through
> postfix as usual) then for some reason filter.sh does not seem to get
> executed
>
> Any ideas / suggestions ?
>

did you add a content_filter statement?

always show 'postconf -n' output.