.NET Service Bus – Remote Desktop over Firewalls!

Today was holiday in Argentina but I had to work on some pending stuff (yeah, lucky me). I didn’t want to travel to the office but I had to access a SQL Server that was hosted at Southworks LAN and we don’t have inbound ports open to connect to our workstations through RDP (port 3389). So…. the .Net Service Bus came to the rescue! Last week David Aiken told me about this cool project hosted on codeplex http://socketshifter.codeplex.com. He told me “these people are streaming video over the service bus”...

So yesterday before leaving the office I opened up the socketshifter server, configured my service bus account and allowed some ports to be redirected. Today I connected from home and here is a nice screenshot of RDP to a Southworks LAN machine (connected to localhost:1000). Isn’t it cool??!!?!


For those of you who are wondering how these work, the code is reeeeallly simple because all of the hardlifting is made by the service bus. There is a client and a server that will redirect a stream of bytes from port a to port b (using plain sockets). The socket shifter client will establish a session to the server via the service bus using the NetTcpRelayBinding. The rest of the story is bytes flowing around :)


This is the client running on my laptop:


And this is the configuration on the client

    <add key="solutionName" value="southworks-magnolia"/>
    <add key="password" value="...."/>   
    <add key="servicePath" value="sb://southworks-magnolia.servicebus.windows.net/rd"/>
    <add key="localPort" value="1000" />
    <add key="remoteHost" value="localhost"/>
    <add key="remotePort" value="3389"/>

The server needs to be installed as a Windows Service to be able to redirect 3389. I also tried accessing the web server (IIS7) that is running on the LAN and it worked (need to configure the remoteport to 80). So that means that I can expose a web server that runs on my desktop machine and show stuff to customers without asking IT to move my machine to the DMZ!! Clemens did something similar couple of months ago.

This is a very cool use of the Service Bus. Go ahead and try it yourself! Download the latest source code.

Published: July 10 2009

blog comments powered by Disqus