Score:0

using putty and socat to run rust server behind firewalls

br flag

i want to run a publicly accessible Rust server on a windows machine behind some routers and firewalls. the idea is tunneling the local server ports to a public machine where they are accessable: rust server on windows behind firewalls <- putty tunnel -> linux with no firewalls <- rust client somewhere on a PC

the rust server runs on port 28015. all works fine locally "client.connect localhost 28015". locally there is also tcp port 28016 for rcon, and i think some magic on udp 28015 - i'm not sure if that is really needed.

with putty i have created a tunnels from windows to the remote linux machine: R28015 127.0.0.1:28015, R28016 127.0.0.1:28016 i can test them using telnet localhost 28015 and telnet localhost 28016. i do NOT get connection refused, so i think the tunnel works. right? i changed the settings in SSHD config, so that also telnet linuxhostname 28015 works.

sadly, it is not possible to connect with the rust client "client.connect linuxhostname 28015". i get timeout.

maybe rust needs the UDP as well. so i try to use socat to get UDP through the TCP tunnel.

i set up another putty tunnel: R50053 127.0.0.1:50053 and used socat to a) on windows map udp 28015 to tcp 50053 locally command: socat udp-listen:28015,reuseaddr,bind=127.0.0.1,fork tcp:127.0.0.1:50053 b) on linux map tcp 50053 to udp 28015 command: socat tcp4-listen:50053,reuseaddr,fork,bind=127.0.0.1 UDP:127.0.0.1:28015

at least that was the plan. after some testing, i'm stuck at a point where i get an error message on linux side: socat[954671] E bind(5, {AF=2 127.0.0.1:50053}, 16): Address already in use.

what's wrong? the whole idea or just the use (config) of socat?

in flag
Why don't you simply configure the firewall in front of the Windows server so that it allows connections to the ports you need?
us flag
If configuring firewall(s) is not an option, then you should use a VPN for the traffic. Much less hacky than socat over SSH tunnel.
weiss100 avatar
br flag
I considered using a VPN but was faced with relatively high costs for what I want to use it. The putty + socst solution should do the job with no extra cost (only a little extra configuration effort). Configuration of the firewalls is not possible.
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.