I'm trying to send mail over proxy (SSH tunnel or SOCKET proxy) by postfix.
I tried to do something like that schema:
I'm using MacOs with no firewall. The receiving client over browser has been omitted to simplify. The last element of the scheme is the mailserver.
I want to replace my IP in the e-mail header, only for privacy (it will be however logged by the SOCKET Proxy or the SSH server).
Here a standard mail header:
Return-Path: <sender@servermailsender.com>
X-Original-To: receiver@servermailreceiver.com
Delivered-To: receiver@servermailreceiver.com
Received: from host.servermailsender.com (unknown [111.111.111.111]) by
mail.servermailreceiver.com (Postfix) with ESMTP id xxxxxxxxxxx for
<receiver@servermailreceiver.com>; Fri, 20 Mar 2020 00:24:34 +0000 (UTC)
Received: by host.servermailsender.com (Postfix, from userid 501) id 6B2xxxxxxD9E;
Fri, 20 Mar 2020 01:24:33 +0100 (CET)
Authentication-Results: mail.servermailreceiver.com; dmarc=none (p=none dis=none)
header.from=servermailsender.com
Authentication-Results: mail.servermailreceiver.com; spf=none
smtp.mailfrom=sender@servermailsender.com
Authentication-Results: mail.servermailreceiver.com; dkim=none
To: receiver@servermailreceiver.com
Subject: Subject
From: A <sender@servermailsender.com>
Reply-To: A <sender@servermailsender.com>
Mime-Version: 1.0
Content-Type: text/html
Message-Id: <20200xxxxxxxB08xxx@servermailsender.com>
.....
I don't want to show 111.111.111.111 (fourth line), i want to change-it and i want to proxify my ip.
What I've done since now it's:
1) Create a tunnel between my machine (127.0.0.1) and the proxy (proxyserver.com) writing on the terminal of my machine
ssh -D 2525 root@proxyserver.com
2) In main.cf I added the line relayhost = [127.0.0.1]:2525
But this configuration don't works.
Nothing arrives to reveiver client.
Help please.
EDIT:
header_checks mods ≠ proxify the IP
"Johannes H." said me to use header_checks with prechecks, but as you can see there are two fields that takes the word Received
This is written locally by 127.0.0.1
Received: by host.servermailsender.com (Postfix, from userid 501) id 6B2xxxxxxD9E; Fri, 20 Mar 2020 01:24:33 +0100 (CET)
This is written remotelly by servermailreceiver.com
Received: from host.servermailsender.com (unknown [111.111.111.111]) by servermailreceiver.com (Postfix) with ESMTP id xxxxxxxxxxx for ; Fri, 20 Mar 2020 00:24:34 +0000 (UTC)
The second it's not editable locally by changing prechecks on my machine (127.0.0.1 in local) and (111.111.111.111 on internet).
It's for this that i want to proxyfy my postifx on 127.0.0.1 over SOCKET proxy v4 or v5 or through SSH tunnel.