Tunnelling rdesktop through SOCKS

Case: I’d like to connect via RDP to a Windows host behind a closed network. But I don’t want to route all traffic through the SOCKS proxy, so configuring the SOCKS proxy in the Mac OS X network settings is a no-go for me. I need to proxy rdesktop through the SOCKS proxy on localhost in a different way. Unfortunately rdesktop does not support SOCKS itself (CoRD does, but only via the Mac OS X network settings).

I tried tsocks and dsocks which use LD_PRELOAD to intercept socket calls and insert their own code to handle the SOCKS proxy. This is a neat way . But that did not work for me somehow. Checking with dtrusssocket() never completed.

Using prtunnel did work:

prtunnel -D -t socks5 -H localhost -P 9999 3334 192.168.194.13 3389
rdesktop localhost:3334

(I did have to compile it manually though as the Darwin Port refused to install due to some checksum issue.)

P.S.: With browsers its simpler. I use Chrome for normal browsing and Firefox, with its network settings set to use SOCKS, to connect to the machines on the closed network.

Leave a Reply

Your email address will not be published. Required fields are marked *