I already have a program that works externally from Postfix.  It is
getting it to work from within Postfix that is the issue.  Even the
script from http://www.postfix.org/FILTER_README.html#simple_filter
does not work.  I think there is something I need to set something in
main.cf.

I added the following to my master.cf per the instructions(zenoss is
the user name)(all one line):

filter    unix  -       n       n       -       10      pipe flags=Rq
user=zenoss argv=/tmp/tmp.filter.sh -f ${sender} -- ${recipient}



$ ll /tmp/tmp.filter.sh
-r-xr-xr-x 1 zenoss users 780 Aug  6 15:51 /tmp/tmp.filter.sh


/tmp/tmp.filter.sh
========================================================
#!/bin/sh

# Simple shell-based filter. It is meant to be invoked as follows:
#       /path/to/script -f sender recipients...

# Localize these. The -G option does nothing before Postfix 2.3.
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# Clean up when done or when aborting.
#trap "rm -f in.$$" 0 1 2 3 15

# Start processing.
cd $INSPECT_DIR || {
    echo $INSPECT_DIR does not exist; exit $EX_TEMPFAIL; }

cat >in.$$ || {
    echo Cannot save mail to file; exit $EX_TEMPFAIL; }

# Specify your content filter here.
# filter <in.$$ || {
#   echo Message content rejected; exit $EX_UNAVAILABLE; }
cat in.$$ > /tmp/tmp.msg.$$

$SENDMAIL "$@" <in.$$

exit $?
========================================================

No thing gets generated in /tmp or /var/spool/filter


On Wed, Aug 6, 2008 at 2:58 PM, Wietse Venema <[EMAIL PROTECTED]> wrote:
> Jamie Bohr:
>> Hello,
>>
>> I am a newbie for advanced Postfix configure, I use Postfix at work
>> but the setting are given to me.  I would like to add a filter but am
>> having trouble understanding what I need to do.  Postfix is a great
>> tool and very extensive, that being said there are a lot of options/
>> configurations an administrator needs to understand; I am hoping the
>> group will get me going the the right direction.
>>
>> I need to write a filter for outgoing mail on a server that runs an
>> external script the analyzes the message (body and header) and
>> determine if:
>>
>> 1. the message should be sent or discarded
>> 2. changes the content of the message when/if appropriate
>>
>> I have the script (Perl) already done, I am having trouble getting
>> Postfix to run the script.  I am using
>> http://www.postfix.org/FILTER_README.html#simple_filter
>> as a guide but am having no success.   I am using postfix-2.3.3-2 on
>> RHEL 5 server.  Some guidance would be greatly appreciated.
>
> If you have difficulties writing a program that runs as a content
> filter, then I strongly suggest that you don't do that.  Instead,
> use a program that already works.
>
>        Wietse
>



-- 
Jamie Bohr

Reply via email to