Proxy to TCP port with real IP - eviltoast

Simple question, difficult solution. I can’t work it out. I have a server at home with a site-to-site VPN to a server in the cloud. The server in the cloud has a public IP.

I want people to access server in the cloud and it should forward traffic through the VPN. I have tried this and it works. I’ve tried with nginx streams, frp and also HAProxy. They all work, but, in the server at home logs I can only see that people are connecting from the site-to-site VPN, not their actual source IP.

Is there any solution (program/Docker image) that will take a port, forward it to another host (or maybe another program listening on the host) that then modifies the traffic to contain the real source IP. The whole idea is that in the server logs I want to see people’s real IP addresses, not the server in the cloud private VPN IP.

  • z3bra@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Setting the default gateway to the VPN has many implications that you must take into account before doing it:

    • you need to allow ALL traffic through the VPN ACL, which nullify the concept of ACL as a security measure.
    • it breaks the VPN as the encapsulated packets cannot reach the other site. You need a /32 route to the other site to keep the VPN up.
    • it will route ALL the internet traffic from this host through the VPN, and the internet access of the other site.
    • it could break access to LAN of the server, so you might need to set your local routes manually.
    • it can let your server access the LAN of the remote server, this leaking local networks.

    A better option would be to use VRFs to route back traffic coming through the VPN back to it.