views:

16

answers:

2

Think of the following services on one box:
 SOCKS proxy
 HTTP proxy
 SSH service
 VPN service

I have found a case where it would be beneficial to run all of these services on the same box (save on high server costs w/ low usage), but they all need to listen on port 80 (network security restrictions require it).

I'm a proficient java developer. What I am brainstorming is whether it's realistic to consider a simple java app listening on port 80, determining which service a new connection is bound for, and then redirecting traffic from that connection to a local port where the service is listening.

Is there something in the initial packets after the connection that I would be able to queue off of to determine the appropriate service?

Creative thoughts are most welcome.

A: 

I don't know the structure of all of those protocols, but I would think that the easiest way to find the answer to your question would be to simply write a program that listens on port 80 and writes the initial data to log files, and then connect with each of the above protocols and see if there are obvious patterns.

Running a network analyser on either the server or the client like WireShark would also work, and you don't have to write any code.

Once you know the patterns, you probably should look up the protocol documentation to verify whether it is really reliable.

Luke Dunstan
A: 

I agree with Luke's answer, and I think that such a creature is within the realm of possibility. Other factors to consider:

  • If the server receives heavy traffic, there may be some performance impact to running this java redirection service, especially if your heuristics for determining the appropriate destination service are complex.
  • For the HTTP service, you may want the java redirector to issue something like a 301 Moved Permanently to the new port.
Reinderien

related questions