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: <email@example.com> X-Original-To: firstname.lastname@example.org Delivered-To: email@example.com Received: from host.servermailsender.com (unknown [220.127.116.11]) by mail.servermailreceiver.com (Postfix) with ESMTP id xxxxxxxxxxx for <firstname.lastname@example.org>; 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 email@example.com Authentication-Results: mail.servermailreceiver.com; dkim=none To: firstname.lastname@example.org Subject: Subject From: A <email@example.com> Reply-To: A <firstname.lastname@example.org> Mime-Version: 1.0 Content-Type: text/html Message-Id: <20200xxxxxxxB08xxx@servermailsender.com> .....
I don't want to show 18.104.22.168 (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 email@example.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.
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 [22.214.171.124]) 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 (126.96.36.199 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.