Wietse Venema wrote:
Kris Deugau:
I came across a bit of an information-passing glitch on a system that
uses a milter (MIMEDefang) to glue together complex filter policies.

MIMEDefang is configured to log sender, first recipient, Message-ID (if
any), and the queue ID, along with some filter result data, for each
message.

This works just fine for messages sent on their own connection.

However, if a remote system sends more than one message during a
connection/session, the queue IDs of the second and further messages are
not passed to/retrieved by the milter;  instead they're logged as
"NOQUEUE".  I've confirmed this works as expected with sendmail, but not
with any version of Postfix up through the current 3.3 snapshot.

Logged as NOQUEUE by Postfix? Milter? Something else? At what
protocol stage?  Envelope? End-of-body? Something else? Actual
logging would clarify a lot. I don't haver the time to drop what
I'm doing and spend hours to reverse engineer your conditions.

Sorry, guess I've been prodding this on and off for too long and forgot some of that wasn't as obvious as to me.

The literal 'NOQUEUE' is a placeholder MIMEDefang initializes its local reference copy of the i macro to. smfi_getsymval(ctx, "i") is called in five places including end-of-message in the C that talks directly to libmilter. The log action I've added that creates the mimedefang.pl log entries below is in a section run at end-of-message.

Here's the full mail log from a test system:

Mar 29 16:35:14 jessie64 postfix/smtpd[17537]: connect from localhost[127.0.0.1] Mar 29 16:35:27 jessie64 postfix/smtpd[17537]: 26F5E428A4: client=localhost[127.0.0.1] Mar 29 16:36:02 jessie64 postfix/cleanup[17556]: 26F5E428A4: message-id=<f...@bar.com> Mar 29 16:36:03 jessie64 mimedefang.pl[17552]: 26F5E428A4: clientip=127.0.0.1 smtpauth= from=kdeu...@deepnet.cx to=f...@example.com messageid="<f...@bar.com>" queueid=26F5E428A4" Mar 29 16:36:03 jessie64 postfix/qmgr[17527]: 26F5E428A4: from=<kdeu...@deepnet.cx>, size=324, nrcpt=1 (queue active) Mar 29 16:36:03 jessie64 postfix/local[17557]: 26F5E428A4: to=<f...@jessie64.pem-lan>, orig_to=<f...@example.com>, relay=local, delay=42, delays=42/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Mar 29 16:36:03 jessie64 postfix/qmgr[17527]: 26F5E428A4: removed
Mar 29 16:36:17 jessie64 postfix/smtpd[17537]: 55ADB428A4: client=localhost[127.0.0.1] Mar 29 16:36:36 jessie64 postfix/cleanup[17556]: 55ADB428A4: message-id=<f...@bar.com> Mar 29 16:36:36 jessie64 mimedefang.pl[17552]: clientip=127.0.0.1 smtpauth= from=kdeu...@deepnet.cx to=b...@example.com messageid="<f...@bar.com>" queueid=NOQUEUE" Mar 29 16:36:36 jessie64 postfix/qmgr[17527]: 55ADB428A4: from=<kdeu...@deepnet.cx>, size=324, nrcpt=1 (queue active) Mar 29 16:36:36 jessie64 postfix/local[17557]: 55ADB428A4: to=<f...@jessie64.pem-lan>, orig_to=<b...@example.com>, relay=local, delay=27, delays=27/0/0/0.03, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Mar 29 16:36:36 jessie64 postfix/qmgr[17527]: 55ADB428A4: removed
Mar 29 16:36:38 jessie64 postfix/smtpd[17537]: disconnect from localhost[127.0.0.1] helo=1 mail=2 rcpt=2 data=2 quit=1 commands=8

and the SMTP transcript:

# telnet localhost 25
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 jessie64.pem-lan ESMTP Postfix
helo local
250 jessie64.pem-lan
mail from:kdeu...@deepnet.cx
250 2.1.0 Ok
rcpt to:f...@example.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: test
Message-ID: <f...@bar.com>

test
.
250 2.0.0 Ok: queued as 26F5E428A4
mail from:kdeu...@deepnet.cx
250 2.1.0 Ok
rcpt to:b...@example.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: test
Message-ID: <f...@bar.com>

test
.
250 2.0.0 Ok: queued as 55ADB428A4
quit
221 2.0.0 Bye
Connection closed by foreign host.
#


For completeness:
# sbin/postconf -n
alias_database = hash:/opt/pfcustom/etc/aliases
alias_maps = hash:/opt/pfcustom/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
default_transport = error
inet_protocols = ipv4
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = jessie64.pem-lan, localhost.pem-lan, localhost, jessie64.deepnet.cx, jessie64, example.com
myhostname = jessie64.pem-lan
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.2.0/24
myorigin = jessie64.pem-lan
readme_directory = no
recipient_delimiter = +
relay_transport = error
relayhost =
smtpd_milters = unix:/var/spool/MIMEDefang/mimedefang.sock
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
virtual_alias_maps = texthash:/opt/pfcustom/etc/virtual_alias
#

-kgd

Reply via email to