On 19.3.2016 15:13, Wietse Venema wrote:
Istvan Prosinger:
[ Charset windows-1252 converted... ]
On 19.3.2016 1:18, Wietse Venema wrote:
Istvan Prosinger:
Why a separate header, why not just:
enable_long_queue_ids = yes
and use the queue ID that's already in your top Received: header?
I would use a header_checks PREPEND action that prepends a header
with the long queue ID from the Received: header.
Sorry, no time to write out a complete example.
Thanks.
Ok, I was thinking of this, but wasn't sure how to "pass" the (long or
not) queue ID (or anything else) in header_checks. Another thought is to
copy one that is already there, but not sure how to do it or how far can
I go in a "one-liner"
/etc/postfix/main.cf:
enable_long_queue_ids = yes
header_checks = /etc/postfix/stamp.pcre
/etc/postfix/stamp.pcre:
# Pattern for /usr/sbin/sendmail submission
/^Received:\sby\sserver\.example\.com\s\S+\s\S+\s\S+\s+id\s(\S+);/
Prepend X-ID $1.server.example.com
# Pattern for SMTP submission
/^Received:\sfrom\s\S+\.example\.com\s\S+\s\S+\s+by\sserver\.example\.com\s\S+\s\S+\s\S+\s+id\s(\S+);/
Prepend X-ID $1.server.example.com
Wietse
Thanks for the ideas. I need to mark the incomming mails for local
storage tracking, not submission, so anyway, I ended up with a shorter
version
/name\.server\.com\s\S+\s\S+\s\S+\s+id\s(\S+)/ Prepend X-DIYL-$1
I recommend starting the pattern with /^Received:.*by name\.server\.com.../
That way it won't have to inspect non-"Received:" headers.
And added to
smtpd_recipient_restrictions = check_recipient_access
pcre:/etc/postfix/stamp.pcre
I'm quite sure that I have a match on the queue id, but the Prepend has
no effect on the header. What am I missing?
Test with:
postmap -h pcre:/etc/postfix/stamp.pcre < file
where the file contains an email message with Received: headers.
Wietse
Wietse
Thanks,
I'll make the pattern search detailed as you suggested.
I've tried what you ask, this is what I got:
[root@email ~]# postmap -h -q - pcre:/etc/postfix/stamp.pcre < testheader
Received: from localhost (localhost [127.0.0.1])
by email-test.server.com (Postfix) with ESMTP id 3qRyhf4pqCzKmYs
for <ist...@email-test.server.com>; Sat, 19 Mar 2016 06:17:54
-0400 (EDT) Prepend X-DIYL-3qRyhf4pqCzKmYs
Received: from knox.prosinger.net (knox.prosinger.net [5.44.101.107])
by email-test.server.com (Postfix) with ESMTPS id 3qRyhf0ChgzKmYq
for <ist...@email-test.server.com>; Sat, 19 Mar 2016 06:17:52
-0400 (EDT) Prepend X-DIYL-3qRyhf0ChgzKmYq
I think that this means two hits. If so, what comes to my mind is that
these headers are not there yet, in the moment when the stamper.pcre is
called.