Score:1

Trying to proxy tcp traffic through a distant server

hu flag

During the past few days I tried a few things to make my VPS proxy tcp traffic (depending on port) to my home server (both ubuntu servers).

Client <------> VPS <------> Home server

To be more specific, I've got a home server running some apps that I want to be hidden behind my VPS (not on the same subnet) and I want source ip to be preserved when a client tries to reach an app on my home server.

Currently I'm running NGinx streams as a reverse proxy. It works pretty well but client ip is lost (replaced by my VPS ip). There is on option to keep it proxy_bind $remote_addr transparent; but it would require my home server to output traffic to my VPS like a gateway (and I do not have a solution for this without having both of them on the same network).

I tried using SSH Port Forwarding but source ip is also lost (replaced by my home server local ip). I also tried IP Gre tunneling (Didn't make it at the end...)...

The best for me would be that my VPS and my home server are connected through a tunnel, I think ?

Client <------> ( VPS <-tunneled-> Home server )

But as I said, all I need is to send VPS port specific traffic to my home server with source ip preserved and my VPS ip as server ip.

Hope someone will have a solution !

Have a great day !

us flag
It is not possible without support from the application protocol.
natsch avatar
hu flag
I have multiple apps but the most important is a docker mail server instance. For mailing it's easy to impersonate my VPS using a relay but in the other way I need the source ip. Does-it help ?
Score:0
hu flag

Finally, I gave up finding a generic solution and used HAProxy in combination with Postfix and Dovecot. See https://www.linuxbabe.com/mail-server/smtp-imap-proxy-with-haproxy-debian-ubuntu-centos

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.