telprox -- a simple telnet proxy daemon
faramir@drunken.scots.net
-----------------------------------

telprox is a program which can act as a telnet proxy to a single host. It binds
to a specified port on the server where it is run, and then relays data back
and forth between the client and the proxied host. 

This is useful for people who need to connect to a site which directly, has a
lot of netlag and that indirectly, from another host, is faster. By running 
telprox on the 'other' host, you can bypass the lag you would normally 
experience.

telprox is distributed under the GNU General Public License 
(see http://www.gnu.org) so you are more or less free to use it as you wish.  
telprox comes with no warranty, actual or implied, so use it at your own risk. 

To be honest, it's pretty stable so far, so you don't have much to worry about.

To Compile:
----------

Unarchive the telprox archive by running ('$' signifies the command line
prompt):

	$ tar -zxvf telprox-0.2.tgz

	or for other versions of tar which don't support compressed files...

	$ gzip -d telprox-0.2.tgz | tar -xvf -

Go into the telprox directory.

There is no Makefile (at the moment) as it is only one file of C (and a header
file). Make sure your system has a C compiler (such as gcc) installed, along
with the associated development libraries, and type:

	$ cc telprox.c -o telprox

...and hey presto the telprox binary should be generated. 

Currently, I have only compiled telprox under linux. There will probably be minor
glitches with other unices. Adjust whatever you need to. 

To Run:
------

You need to set up your telprox config file before running. At the moment, this 
file only supports one feature: the identity of the host to be proxied. The 
file, named "telprox.conf", contains the IP address and port number of the host 
to be proxied. You can generate the file very simply by finding the IP address
of the host you wish to proxy, assuming the machine you're on at the moment is 
connected to the net and has a nameserver:

	$ nslookup my.proxied.host.name 

and that should report the IP address. 
Then do:

	$ cat > telprox.conf
	MY.PROXIED.IP.ADDRESS <space> PORTNUMBER <return>
	<control-D>

That will create a file, one line long with the IP address and port number 
in it. So you can proxy your own host by having a telprox.conf file which looks 
like this:

	$ cat telprox.conf
	127.0.0.1 23

When you actually run telprox, you just type:

	$ telprox

BUT! Doing so will start the daemon and send all debugging output to your 
console so doing:

	$ telprox >& /dev/null

is a much better idea.  However, for the first time, I recommend you don't 
redirect the output to /dev/null so that if telprox dies for some reason when 
booting up, you'll be able to see what's wrong. Typically, it might not be 
able to bind() to the default port (the default port is 1536), or it might 
find that your config file is broken.  

To specify the local port to run telprox on, include it as a command line 
argument, so

	$ telprox 9000 >& /dev/null

will run the daemon on port 9000. I'll probably include the local port 
specifier as a config file feature at some point.  Also, 
	
	$ telprox -h

will always give you the command line options available to you.

If you want to change any of the default settings, then just edit source files
and recompile. 

Bugs and Suggestions
-------------------

Please email me on faramir@drunken.scots.net 
My web pages are at http://www.scots.net/~faramir/

How it works
------------

telprox launches a daemon process which binds to a local port on the server on
which it is run. Any incoming connections to this port triggers telprox to 
fork(), giving the connection its own dedicated handler.  This handler then 
says hello to the user at the end of the connection and connects to the 
runtime proxy host.  Data is then blatted back and forth between the client 
and proxy using buffered throughput and ioctl() calls to ensure that all 
information is transmitted.

When one end dies off, i.e. if you 'quit' your telnet client or the proxy host 
closes the connection, telprox kills off all connections, tidies things up a bit
and then shuts itself down.  There is always one telprox running, as the parent.
This version of telprox doesn't support being called by the inetd/tcpd although that
might change in future (if I have time).  

As another future possibility, I might add the facilities:
	-multiple host proxying under one telprox session (with a menu system 
	 for connecting clients)
	-security, with access denial to unpriviliged hosts

As a suggestion: sys admins running firewalling on their UNIX systems ( e.g.
"ipfwadm" under Linux) could set up telprox to redirect connections to certain
ports on their server, to completely different places. 


---------------------------------------------------------------------------
