20 Mar 2003 11:00:56 UTC
- Distribution: connect-tunnel
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (4 / 0 / 0)
- License: unknown
- Activity24 month
- Download (4.79KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This versionBOOK Philippe Bruhat (BooK)
connect-tunnel - Create CONNECT tunnels through HTTP proxies
connect-tunnel [ -v ] [ -A user:pass ] [ -P proxy:port ] -T port:host:hostport [ -T port:host:hostport ]
connect-tunnel sets up tunneled connections to external hosts by redirecting connections to local ports towards thoses hosts/ports through a HTTP proxy.
connect-tunnel makes use of the HTTP
CONNECTmethod to ask the proxy to create a tunnel to an outside server. Be aware that some proxies are set up to deny some outside tunnels (either to ports other than 443 or outside a specified set of outside hosts).
The program follows the usual GNU command line syntax, with long options starting with two dashes.
- -A, --proxy-authentication user:password
Proxy authentication information.
Please note that all the authentication schemes supported by LWP::UserAgent are supported (we use an LWP::UserAgent).
This means we also support NTLM, since it is supported as from libwww-perl 5.66.
- -L, --local-only
Create the tunnels so that they will only listen on
localhost. Thus, only connections originating from the machine that runs connect-tunnel will be accepted.
That was the default behaviour in connect-tunnel version 0.02.
- -P, --proxy proxy[:port]
The proxy is required to connect the tunnels. If no port is given, 8080 is used by default.
See also "ENVIRONMENT VARIABLES".
- -T, --tunnel port:host:hostport
Specifies that the given port on the local host is to be forwarded to the given host and hostport on the remote side. This works by allocating a socket to listen to port on the local side, and whenever a connection is made to this port, the connection is forwarded through the proxy, and a connection is made to the remote host at port hostport.
On Unix systems, only root can forward privileged ports.
Note that you can setup tunnels to multiple destinations, by using the --tunnel option several times.
- -U, --user-agent string
Specify User-Agent value to send in HTTP requests. The default is to send
- -v, --verbose
This option can be used several times for more verbose output.
To connect to a SSH server running beyond the proxy on port 443, through the proxy proxy.company.com, running on port 8080, use the following command:
connect-tunnel -P proxy.company.com:8080 -T 22:ssh.example.com:443
And now point your favorite ssh client to the machine running connect-tunnel.
You can also emulate a "standard" user-agent:
connect-tunnel -U "Mozilla/4.03 [en] (X11; I; Linux 2.1.89 i586)" -P proxy.company.com:8080 -T 22:ssh.example.com:443
connect-tunnel can easily use your proxy credentials to connect outside:
connect-tunnel -U "Mozilla/4.03 [en] (X11; I; Linux 2.1.89 i586)" -P proxy.company.com:8080 -T 22:ssh.example.com:443 -A book:s3kr3t
But if you don't want anybody else to connect to your tunnels and through the proxy with your credentials, use the --local-only option:
connect-tunnel -U "Mozilla/4.03 [en] (X11; I; Linux 2.1.89 i586)" -P proxy.company.com:8080 -T 22:ssh.example.com:443 -A book:s3kr3t -L
If you have several destinations, there is no need to run several instances of connect-tunnel:
connect-tunnel -U "Mozilla/4.03 [en] (X11; I; Linux 2.1.89 i586)" -P proxy.company.com:8080 -A book:s3kr3t -L -T 22:ssh.example.com:443 -T 222:ssh2.example.com:443
But naturally, you will need to correctly set up the ports in your clients.
Mmm, such a long command line would perfectly fit in an alias or a .BAT file.
The LWP::UserAgent that is used to connect to the proxy accept the usual
HTTP_PROXYenvironment variable to define the proxy.
The environment variable is overriden by the --proxy option, if passed to connect-tunnel.
Next version should have an option to create a control port, to which one could connect to interact with connect-tunnel and add/remove tunnels, close connections, change the User-Agent string, and so on.
Philippe "BooK" Bruhat <email@example.com>
I seem to have re-invented a well-known wheel with that script, but at least hope I have added a few interesting options to it.
Bits of the documentation wording is stolen from OpenSSH documentation about options -L and -R.
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
Module Install Instructions
To install connect-tunnel, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install connect-tunnel
For more information on module installation, please visit the detailed CPAN module installation guide.