RE:  the after-queue, simple filter example

Just trying to figure out how it works.
I have a feeling I don't fully understand the full implications of
"after-queue".

>From master.cf:
#       custom filter
filter  unix    -       n       n       -       10      pipe
  flags=Rq user=filter null_sender=
  argv=/VOLUMES/gizmonics/work/afterqueue/simple -f ${sender} -- ${recipient}

The user is in 
[root@clemi postfix]# grep -w filter /etc/passwd /etc/group
/etc/passwd:filter:x:506:506:smtp filter:/var/spool/filter/:/bin/bash
/etc/group:filter:x:506:

The user filter owns the directory
[root@clemi postfix]# ls -ld /var/spool/filter/
drwxr-xr-x 2 filter filter 4096 Jun 10 14:49 /var/spool/filter/

The user filter owns the script
[root@clemi postfix]# ls -l /VOLUMES/gizmonics/work/afterqueue/simple
-rwxr-xr-x 1 filter filter 814 Jun 10 14:46 
/VOLUMES/gizmonics/work/afterqueue/simple

I've run that from the command line, ie:

/VOLUMES/gizmonics/work/afterqueue/simple -f gl -- b...@idiot.com < 
/VOLUMES/gizmonics/work/afterqueue/dull

and it works when run like that.  The simple script does what I expect, and the 
mail
does get to bbb's mail file.

Here's my simple script, which is just the example script from the
FILTER_README.html page with only two or so lines changed, marked below:


#!/bin/bash

# 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; }

###     this sed line is added, and the $SENDMAIL changed to read from smak.$$
###     otherwise, it's completely stock.
sed -e 's/http/hxxp/g' in.$$ > smak.$$

$SENDMAIL "$@" <smak.$$

exit $?


-------
I've changed master as shown above.
I've done postfix reload.

But all of my tests like so:

mail -s "wogujwrg" b...@idiot.com < test.input.file

deliver the test.input.file unmodified.  Do I not understand what
"after-queue" means?  I've been assuming this would, sooner or later,
send things to the filter.  It looks to me like it's bypassing
the filter.

j.

-- 
Jay Scott               512-835-3553            g...@arlut.utexas.edu
Head of Sun Support, Sr. System Administrator
Applied Research Labs, Computer Science Div.                   S224
University of Texas at Austin

Reply via email to