Updated 2012-10-02 10:06:09 by LkpPo

[...]

Tunnelling solutions commonly used outside the Tcl world include SSH port forwarding, Zebedee, Stunnel [1], ...

See SSL Tunnel for a script that tunnels through web proxy servers using tls.

SockSpy can also be used for tunnelling. For example, I've used it to access my university's news feed machine from a remote site (the news feed machine would only accept local connections). KPV

See also


Another recipe, for use in establishing a tunnel into a firewalled LAN that, in principle, only allows outbound SSH:
    ssh -f -l special_user -N -g -R 6005:localhost:22 external_server

Then, from the external_server prompt:
    ssh -p 6005 my_account@localhost

This logs into my_account@firewalled_host.

This should only be used under supervision and with explicit permission from the guardians of firewalled_host, of course.

MJ - If you are behind a proxy that will only allow traffic on port 80 and you have a box you have shell access on, you can use the following script to forward requests to port 80 to another endpoint.
 set dstport 8888
 set dsthost host.i.want.to.go
 proc transfer {src dest} {
   set data [read $src]
   if {[eof $src] || [eof $dest]} {
       close $src
       close $dest
   }
   catch {
     puts -nonewline $dest $data
     flush $dest
   }
 }

 proc conn {socket args} {
   set s [socket $::dsthost $::dstport]
   puts "connection $socket $args -> $s"
   fconfigure $s -blocking 0 -translation binary -encoding binary
   fconfigure $socket -blocking 0 -translation binary -encoding binary
   fileevent $s readable [list transfer $s $socket]
   fileevent $socket readable [list transfer $socket $s]
 }
 socket -server conn 80
 vwait forever