On Tue, Nov 29, 2005 at 12:22:22PM +0100, the unit calling itself Ruud H.G. van
Tol wrote:
Dallman Ross:
J Moore:
I understand that re-writing Received: headers is a somewhat
controversial subject, and can lead to all sorts of problems if
it's not done correctly. I need a solution that's maintainable -
I think procmail can do this based on Weldon Whipple's "How-To"
document at: http://www.technoids.org/procmailfilter.html, and a
"recipe" in the sendmail Cookbook. Both, however, seemed to stop
short of where I need to go.
Q: Can procmail do this?
If you just want to delete the offending (to your system policy)
Received header, I can think of a decent way. But I need to
know if this header is always the bottom one, or if it's in the
middle somewhere (more work).
Good point - Check me out on this, but I believe the offending header
will actually always be the "latest" (time-wise) header written, since
it is written as the message is leaving the smtp server. I would tend to
call this the "top-most" header because it's at the leading edge of the
stream, but I am ignorant of any conventions here.
To refer to my example headers again, they were intended to show what
the headers looked like after they arrived at the host
listserver.somewhere.org. So header #2 was actually written by
listserver.somewhere.org. When the message leaves smtp.domain2.net I
think header #1 will be "on top" and the "latest" header
< header # 2 >
Received: from smtp.domain2.net (root(_at_)smtp(_dot_)domain2(_dot_)net
[A.B.C.D])
by listserver.somewhere.org (8.13.3/8.13.3) with ESMTP id
jAV5B8sC227318
for <listowner(_at_)somewhere(_dot_)org>; Tue, 22 Nov 2005 23:11:08 -0600
(CST)
< header # 1 >
Received: from [192.168.1.75] (fw.domain1.com [E.F.G.H])
by smtp.domain2.net (8.13.4/8.12.11) with ESMTP id jAV5B7N6018915
for <listowner(_at_)somewhere(_dot_)org>; Tue, 22 Nov 2005 23:11:07 -0600
(CST)
In any case, headers that were written earlier in the volley have
already been rewritten to remove the offending hostname & ip addr.
Therefore, the only one we need worry about here is the most recently
added header. (An exception would be if the message made intermediate
stops on the internal network, but I can overlook that for the time
being.)
As described, he wants to *change* an old Received header.
You got that right... actually I could probably live with deleted
headers, but much prefer re-writing. It doesn't sound like this will
complicate things significantly.
If all that has to be changed in the message, is that particular
Received header field, I would choose sed, even without procmail.
Great idea :) But you're going to have to tell me how to connect sed to
sendmail. procmail's hook into sednamil is in the .mc (or.cf) file, but
I'm unclear (or perhaps it's too late in the day) on how to pipe
sendmail through sed.
Do you need to pickup the domain and [A.B.C.D] from the one-newer
Received-header, or is that static information?
All I need to pick up is: 'fw.domain1.com [E.F.G.H]'
/^Received: from \[192\.168\.1\.75\]/, / {
# unfold
# change
# refold
}
The unfolding and refolding are not necessary when what has to be
changed is always on a single line, but better be safe than sorry.
Please contact http://groups.yahoo.com/group/sed-users/ for help on
sed-issues.
With procmail, you could use my snr-code, see
http://www.xs4all.nl/~rvtol/procmail/
I looked at the code in the file 'snr_demo.rc'... but there were no
comments, so I had trouble understanding it :). I will figure that out
if you'll confirm that is the code you referred to above.
Many Thanks,
Jay
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail