IP-Stripping mit Postfix

Mal als kleiner Merkzettel für mich oder falls es jemand mal gebrauchen kann.

/etc/postfix/master.cf

submission inet n       -       n       -       -       smtpd
        -o syslog_name=postfix/submission
        -o smtpd_tls_security_level=encrypt
        -o smtpd_sasl_auth_enable=yes
        -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
        -o smtpd_client_restrictions=permit_sasl_authenticated,reject
        -o smtpd_client_connection_count_limit=10
        -o cleanup_service_name=header

pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
header    unix  n       -       -       -       0       cleanup
        -o header_checks=pcre:/etc/postfix/replace_header.pcre

/etc/postfix/replace_header.pcre

/^\s*(Received: from)[^\n]*(.*)/ REPLACE $1 [127.0.0.1] (localhost [127.0.0.1])$2

=

Received: from mx.domain.tld
	by mx.domain.tld with LMTP id XXXXXXXXXXXXXXXX
	for <null@domain.tld>; Mon, 15 Sep 2014 11:55:54 +0200
Received: from [127.0.0.1] (localhost [127.0.0.1])
	by mx.domain.tld (Postfix) with ESMTPSA id XXXXXXXXXXXX
	for <null@domain.tld>; Mon, 15 Sep 2014 11:55:53 +0200 (CEST)