OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
RE: After queue filter in 2.3-20060325

From: Marcel de Reuver (marcelde.reuver.org)
Date: Mon Apr 03 2006 - 11:55:55 CDT


On Mon, Apr 03, 2006 at 16:19:21 +0200, Victor Duchovni wrote:
>
> On Mon, Apr 03, 2006 at 03:47:30PM +0200, Marcel de Reuver wrote:
>
> > I did an update from Postfix 2.2.x to 2.3-20060325. I use
> > after queue filtering to get a text or html disclaimer added to
> > every outgoing email.
> > The filter configuration must be changed to get mail out without
> > errors. The script 'disclaimer.sh' is unchanged.
> >
> > In master.cf the configuration was:
> > 192.168.10.5:smtp inet n - n - - smtpd
> > -o content_filter=dfilt:dummy
>
> > dfilt unix - n n - 10 pipe
> > flags=Rq user=filter argv=/usr/local/etc/postfix/disclaimer.sh -f
> > ${sender} -- ${recipient}
> >
> > It must be changed in:
> > dfilt unix - n n - 10 pipe
> > flags=Rq user=filter argv=/usr/local/etc/postfix/disclaimer.sh -f
> > ${sender} ${recipient}
> >
> > The original -- made a extra email send out to -- This extra email
> > ended in error, undeliverable.
> >
> > Without the "--" everything works fine now, but the docs
> > doesn't say anything about this change.
>
> There is no change. The "argv" array is passed to
> disclaimer.sh. Any mishandling of the arguments is to be found there.
>
> How are you invoking "sendmail" to re-inject the mail in
>
> Have the script log its arguments and the sendmail command
> line. Report these.
>
> postlog -t postfix/disclaimer.sh -- my commandline: $0 "$"
> postlog -t postfix/disclaimer.sh -- sendmail commandline:
> ...cut/paste...
> disclaimer.sh? Which sendmail are you invoking?
>
> --
> Viktor.
>

disclaimer.sh (now with postlog commands) is as follows:

=====================================================================
#!/bin/sh
# Localize these.
INSPECT_DIR=/var/spool/filter
SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.

/usr/local/sbin/postlog -t postfix/disclaimer.sh -- my commandline: $0 "$"

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

/usr/local/bin/altermime --input=in.$$ \
    --disclaimer=/usr/local/etc/postfix/disclaimer.txt \
    --disclaimer-html=/usr/local/etc/postfix/disclaimer.html || \
        { echo Message content rejected; exit $EX_UNAVAILABLE; }

/usr/local/sbin/postlog -t postfix/disclaimer.sh -- sendmail commandline:
"$"

$SENDMAIL "$" <in.$$

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

/usr/sbin/sendmail is a link to /usr/local/sbin/sendmail the Postfix
sendmail.

Logging with the "--" in master.cf:

Apr 3 18:34:09 mailhost postfix/smtpd[77786]: connect from
xxx[192.168.10.26]
Apr 3 18:34:09 mailhost postfix/smtpd[77786]: D4DF147309C:
client=xxx[192.168.10.26]
Apr 3 18:34:09 mailhost postfix/cleanup[77789]: D4DF147309C:
message-id=<697F49EF1A9CCA4888C808AA1C020C8805C55Fxxx>
Apr 3 18:34:09 mailhost postfix/smtpd[77786]: disconnect from
xxx[192.168.10.26]
Apr 3 18:34:09 mailhost postfix/qmgr[77686]: D4DF147309C:
from=<m.de.reuverxxx>, size=793, nrcpt=1 (queue active)
Apr 3 18:34:10 mailhost postfix/disclaimer.sh: my commandline:
/usr/local/etc/postfix/disclaimer.sh -f m.de.reuverxxx --
marcelde.reuver.org
Apr 3 18:34:10 mailhost postfix/disclaimer.sh: sendmail commandline: -f
m.de.reuverxxx -- marcelde.reuver.org
Apr 3 18:34:10 mailhost postfix/pickup[77685]: 743F9473213: uid=1008
from=<m.de.reuverxxx>
Apr 3 18:34:10 mailhost postfix/cleanup[77789]: 743F9473213:
message-id=<697F49EF1A9CCA4888C808AA1C020C8805C55Fxxx>
Apr 3 18:34:10 mailhost postfix/pipe[77790]: D4DF147309C:
to=<marcelde.reuver.org>, relay=dfilt, delay=0.74, delays=0.13/0.02/0/0.59,
dsn=2.0.0, status=sent (delivered via dfilt service)
Apr 3 18:34:10 mailhost postfix/qmgr[77686]: 743F9473213:
from=<m.de.reuverxxx>, size=2037, nrcpt=2 (queue active)
Apr 3 18:34:10 mailhost postfix/qmgr[77686]: 743F9473213: to=<--xxx>,
orig_to=<-->, relay=none, delay=0.12, delays=0.08/0.05/0/0, dsn=5.1.3,
status=bounced (bad address syntax)
Apr 3 18:34:10 mailhost postfix/qmgr[77686]: D4DF147309C: removed

Logging without "--" in master.cf:

Apr 3 18:36:38 mailhost postfix/smtpd[77836]: connect from
xxx[192.168.10.26]
Apr 3 18:36:38 mailhost postfix/smtpd[77836]: 8ADB147309D:
client=xxx[192.168.10.26]
Apr 3 18:36:38 mailhost postfix/cleanup[77837]: 8ADB147309D:
message-id=<697F49EF1A9CCA4888C808AA1C020C8805C560xxx>
Apr 3 18:36:38 mailhost postfix/qmgr[77830]: 8ADB147309D:
from=<m.de.reuverxxx>, size=793, nrcpt=1 (queue active)
Apr 3 18:36:38 mailhost postfix/smtpd[77836]: disconnect from
xxx[192.168.10.26]
Apr 3 18:36:38 mailhost postfix/disclaimer.sh: my commandline:
/usr/local/etc/postfix/disclaimer.sh -f m.de.reuverxxx marcelde.reuver.org
Apr 3 18:36:38 mailhost postfix/disclaimer.sh: sendmail commandline: -f
m.de.reuverxxx marcelde.reuver.org
Apr 3 18:36:38 mailhost postfix/pickup[77828]: A7C1E473213: uid=1008
from=<m.de.reuverxxx>
Apr 3 18:36:38 mailhost postfix/pipe[77838]: 8ADB147309D:
to=<marcelde.reuver.org>, relay=dfilt, delay=0.15, delays=0.05/0.02/0/0.09,
dsn=2.0.0, status=sent (delivered via dfilt service)
Apr 3 18:36:38 mailhost postfix/qmgr[77830]: 8ADB147309D: removed

It was working with Postfix 2.2.x, now only without the "--" in master.cf.

Best regards,
Marcel