On 8/16/07, Bob Proulx wrote:
> Marc Perkel wrote:
> > Just need a quick answer from a Postfix user. Suppose Postfix is
> > forwarding a message. Is there any way it can add a header with the
> > original IP of the host that they got the message from?
> >
> > X-Original-IP: 0.0.0.0

>
> The Received: headers should contain this information already. For
> example in your message:
>
> Received: from mail.apache.org (hermes.apache.org [140.211.11.2])
> by joseki.proulx.com (Postfix) with SMTP id BAA61FA63
> for ; Thu, 16 Aug 2007 18:33:21 -0600 (MDT)
> ...
> Received: from [69.50.231.8] (HELO darwin.ctyme.com) (69.50.231.8)
> by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Aug 2007 00:33:15 +0000
>
> However additional headers may be added using PREPEND in a
> check_recipient rule.
>
> http://www.postfix.org/header_checks.5.html
>
> Bob
>


Yes, PREPEND is the right action, but to add an X-IP header you will
need to use a check_client_access regexp map (not a header_checks) and
you will need to do it in smtpd_data_restrictions so that only one
header is added (smtpd_{client, helo, sender, recipient}_restrictions
are run once for each recipient - so the header would be added once
for each recipient if you did the check there).

use something like:

# main.cf
smtpd_data_restrictions =
check_client_access regexp:/etc/postfix/add_client_header

# add_client_header
/^(.*)$/ PREPEND X-Original-Client-MyHostname: $1

--
Noel Jones