Help

Help for "tonjac HTTP-Tunnel" version 1.2

[Return to admin] [download]

[Whats new]

What is tonjac HTTP-Tunnel?
tonjac HTTP-tunnel is a set of tools to create tunnels that encodes any TCP-socket traffic as HTTP.



Example 1: VNC/RFB in a encrypted http-tunnel

Why do I need a HTTP-tunnel?
HTTP-traffic can be passed thru any Proxy or webserver. If you use a HTTP-tunnel you can route any TCP traffic via a restrictive proxy that only allowes HTTP-traffic. You can route all your incomming and outgoing traffic from your site via your webserver and you don't have to open any extra ports in your firewall. If your webserver supports SSL you can encrypt all the traffic.

Why should I choose tonjac HTTP-tunnel?
There is a number of software programs build for the perpose of creating HTTP-tunnels, both free and commercial. The reasons to the birth of "tonjac HTTP-tunnel" was the following:

1) Most tunnel software that did "all the tricks" where expensive.
2) The free alternatives did not support SSL directly. You had to use them together with some kind of SSH software and this gets quite complex.
3) There were no tunnels that supported URL-routing.

How do I create a tunnel?
A tunnel is created by a client- and a server-side. The serverside is created with the http2sock service and the clientside is created with the sock2http console tool or from the admin HTML interface served by http2sock. A tunnel can be setup for a session or a sessionless communication model.



Example 2: Server- and client- sides of a tunnel that tunnels FTP


Http2sock service
Http2sock is implemented as a windows service and can be installed i two modes. The default mode (the setup program installes it like this) is the "Admin mode" where the service serves the "Admin HTML interface" on the selected port (default 8080). Via the admin interface you can create both the client- and server- sides of a HTTP-tunnel. The service can also be setup in the "Serverside mode" which means that the service process primary serves a server side of a HTTP-tunnel.


Figure 1. Http2sock modes


Command line interface:
http2sock -m {install|remove|debug} -l listen_port -fh forward_host -fp forward_port (0=admin mode) [-session false] [-pwd admin_password]

Example for "Admin mode":
http2sock -m install -l 8080 -fh localhost -fp 0 -session false -pwd hackme

Example for "Serverside mode":
http2sock -m install -l 5899 -fh localhost -fp 5900 -pwd hackme

Note: even though you setup the service for "Serverside mode" the Admin HTML interface is served and therefore a password must be supplied to secure creation of additional tunnels served be the same server process. If no password is supplied the defaultpassword "dirtydozen" is used.

When http2sock has been installed as a service you start it in the Control pannels "Services" applet:


Figure 1.1 Start the http2sock service


Sock2http console tool
As desribed above the clientside of a tunnel can be created in the Admin interface, but sometimes, you might want to create a tunnel in a script or batch file. For this perpose you can use the sock2http command tool.

Command line interface:
sock2http -l listen_port -fh forward_host -fp forward_port -uri url -proto {http|https} [-cc path to PKCS#12 encoded client cert file] [-cp client cert password][-ph proxy_host -pp proxy_port] [-session false] [-noexit true]

Example:
sock2http -l 5900 -fh www.anywhere.com -fp 443 -uri /vnc/ -proto https -cc c:/path/to/my/cert.p12 -cp hackme -ph yourproxy.com -pp 8080
sock2http -l 139 -fh www.anywhere.com -fp 443 -uri /netbios-ssn/ -proto https -ph yourproxy.com -pp 8080 -noexit true

Sample script:
@title HTTP-tunnel VNC
@start /B sock2http -l 5900 -fh www.anywhere.com -fp 443 -uri /vnc/ -proto https -cc c:/path/to/my/cert.p12 -cp hackme -ph yourproxy.com -pp 8080
@c:/program/realvnc/VNC4/vncviewer.exe

Admin HTML interface
In the admin HTML interface you can create both the server- and client- side of a HTTP-tunnel. The interface is accessed at the following URL: http://localhost:8080/cgi-bin/tunnel/list (default installation). Creation of server and client side tunnels in the admin interface is quite straight forward and takes exactly the same input as the command line interfaces to sock2http and http2sock. You may also close tunnels created in the same interface.


Figure 2.1. Creation of the serverside of a tunnel


Figure 2.2. Creation of the clientside of a tunnel


Figure 2.3. Close a tunnel

URL-routing
To minimize the number of ports you must have opened in your firewall and to be able to encrypt your traffic you should route all incomming traffic via a webserver. The Apache webserver is a free webserver well suited for this perpose. See below for a breif description of how to configure Apache to route incomming traffic to http2sock.

Example Apache configuration:

...
LoadModule proxy_module modules/mod_proxy.so
...
ProxyRequests Off
ProxyPass /vnc/ http://localhost:5899/
ProxyPassReverse /vnc/ http://localhost:5899/
...

SSL support
sock2http has full support for SSL (including clientcerts) but http2sock does not. So to be able to support SSL you must route via a webserver that does. The Apache webserver is a free webserver well suited for this perpose. You can read how to setup Apache with SSL here.