Re: using header_checks to change message-id header

2011-08-20 Thread Bastian Blank
On Mon, Aug 15, 2011 at 09:30:37AM -0500, Jerico2day wrote:
 I'd like to have postfix dynamically change my.domain.com only on
 Message-Id header  to some arbitrary domain that would be
 public-facing for all outgoing mail and change it back for incoming
 mail.

Care to explain how you intend to guarantee the uniqueness of the
message-ids?

Bastian

-- 
We Klingons believe as you do -- the sick should die.  Only the strong
should live.
-- Kras, Friday's Child, stardate 3497.2


Re: using header_checks to change message-id header

2011-08-16 Thread Ralf Hildebrandt
* Peter Blair popc...@snickers.org:
 On Mon, Aug 15, 2011 at 10:30 AM, Jerico2day jerico2...@gmail.com wrote:
  I'd like to have postfix dynamically change my.domain.com only on
  Message-Id header  to some arbitrary domain that would be
  public-facing for all outgoing mail and change it back for incoming
  mail.
 
  Unfortunately, I'm not quite sure how to do that. I would appreciate
  any assistance.
 
 First in your main.cf:
 
 header_checks = pcre:/etc/postfix/header_checks
 
 Secondly in your /etc/postfix/header_checks:
 
 /Message-Id:\s+(.*?)@my.domain.com/   REPLACE Message-Id: 
 $1...@my.domain.net

Warning: this might also alter Resent-Message-Id: into Message-Id:!!!

/^Message-Id:\s+(.*?)@my\.domain\.com$/   REPLACE Message-Id: 
$1...@my.domain.net

could be more robust.

-- 
Ralf Hildebrandt
  Geschäftsbereich IT | Abteilung Netzwerk
  Charité - Universitätsmedizin Berlin
  Campus Benjamin Franklin
  Hindenburgdamm 30 | D-12203 Berlin
  Tel. +49 30 450 570 155 | Fax: +49 30 450 570 962
  ralf.hildebra...@charite.de | http://www.charite.de



Re: using header_checks to change message-id header

2011-08-16 Thread Peter Blair
On Tue, Aug 16, 2011 at 2:35 AM, Ralf Hildebrandt
ralf.hildebra...@charite.de wrote:
 * Peter Blair popc...@snickers.org:

 /Message-Id:\s+(.*?)@my.domain.com/   REPLACE Message-Id: 
 $1...@my.domain.net

 Warning: this might also alter Resent-Message-Id: into Message-Id:!!!

-1s/might/will/

Cheers! :)


Re: using header_checks to change message-id header

2011-08-16 Thread Jerico2day
Thanks all for the help. I decided instead to just replace all
instances of my internal domain using the following on my gateway
server:

/^(.*?)internal\.domain\.com(.*?)/  REPLACE ${1}pretend_name.domain.com${2}

This is because it wasn't modifying the Resent-Message-Id headers.

And on my internal server I just reverse the process. It doesn't seem
to work on lines containing multiple references to my internal server,
but that doesn't really affect me as I remove the received lines
altogether when it crosses my gateway.

Anyway, thanks again for the help!


Re: using header_checks to change message-id header

2011-08-15 Thread Peter Blair
On Mon, Aug 15, 2011 at 10:30 AM, Jerico2day jerico2...@gmail.com wrote:
 I'd like to have postfix dynamically change my.domain.com only on
 Message-Id header  to some arbitrary domain that would be
 public-facing for all outgoing mail and change it back for incoming
 mail.

 Unfortunately, I'm not quite sure how to do that. I would appreciate
 any assistance.

First in your main.cf:

header_checks = pcre:/etc/postfix/header_checks

Secondly in your /etc/postfix/header_checks:

/Message-Id:\s+(.*?)@my.domain.com/   REPLACE Message-Id: 
$1...@my.domain.net

Thirdly, test it:

$ postmap -q Message-Id: sdfsfsdf...@my.domain.com
pcre:/etc/postfix/header_checks

 Thanks!

Note, ensure that your postfix installation supports pcre. My desktop
is debian, so I call:

$ apt-cache search postfix-pcre
postfix-pcre - PCRE map support for Postfix