Hi Karol,
> I am using this:
>
> /^(Received:) from.*]\).*(.{2}by mail\.nimitz\.pl.*Postfix.*) (with
> [E]{0,1}SMTP[S]{0,1}[A]{0,1}) (.*)/ REPLACE $1 from mail.nimitz.pl
> (localhost [127.0.0.1])$2 with SMTP $4
>
> Just change 'mail.nimitz.pl' with FQDN of your server. This expression
> works for me and also removes information about the connection, which in
> my case can tell if the mail was sent from webmail (unencrypted
> connection from webmail host to postfix host) or client's MUA
> (encrypted).
>
> It can probably fail on some systems due to .* matching, which is
> greedy, but I wrote it many years ago and it works, so I am not fixing
> it.
Thanks for this. I’m looking to mask out the DDNS name of a xDSL connection.
I tried the following with a visual regex program (to make checking captures
easier):
/etc/postfix/submission_privacy_header
/(Received\:\s*from)[^\;]+(\;\s[A-Z]{1}[a-z]{2,3}\,)\s+(\d{1,2}[^\n]+)/
REPLACE $1 [127.0.0.1] (localhost [127.0.0.1]) by myserver.com$2 $3
…however this does not match when Postfix evaluates it. I am attempting three
captures:
1. Received: from
2. The first part of the date from the ; to the , after the day (eg: “Fri”)
3. The last part of the date from the numerical day number to the end
The reason for the two part handling of the date is I want to strip out
whitespace between “Day, 6 Apr . . .”. If I don’t strip this out it puts a
line break inline in the Received: header that breaks the date over two lines.
Does anyone know what I’m doing wrong and/or is there a way to make Postfix
provide more debug output for a regexp: operation ?
Thanks,
- J