Net::SSH::Tunnel - This is a simple wrapper around ssh to establish a tunnel. Supports both local and remote port forwarding.
Version 0.01
Perl module to setup / destroy a ssh tunnel.
# create a very short driver script. $ vi driver.pl #!/usr/bin/perl use strict; use warnings; use Net::SSH::Tunnel; Net::SSH::Tunnel->run(); # run the driver script with options. $ ./driver.pl --host dest.example.com --hostname hostname.example.com # the above is equivalent to creating a local port forwarding like this: # ssh -f -N -L 10000:dest.example.com:22 <effective username>@hostname.example.com # after the driver script is done, you can then do: ssh -p 10000 user@localhost # Notes on testing: # This module wraps around ssh and as such, requires authentication. # I have included test_deeply.pl that asks for hostnames, runs ssh and establishes a tunnel. # If you'd like to test manually, please use the script.
Description: The constructor. Creates an object, invokes init() for argument parsing Arguments: none Returns: object
Description: Arg parser. Sets default values, uses Getopt::Long then do the necessary parsing. Arguments: none Returns: none, but updates the object with parsed args. Croaks on error.
Description: Driver method to do the new()->init() dance, then calls appropriate methods based on the args Arguments: none Returns: none, but may croak on error
Description: Establishes a ssh tunnel based on the object info. Arguments: none Returns: none, but may croak on error
Description: Runs ps and finds an existing tunnel, according to the parameters supplied Arguments: none Returns: pid of tunnel
Description: Calls check_tunnel() for existing tunnel, and if it exists, kills it. Arguments: none Returns: none, croaks if it fails to kill. if there wasn't a tunnel, it doesn't do anything
Description: The sub to provide help. Arguments: none Returns: none, and exits
Satoshi Yagi, <satoshi.yagi at yahoo.com>
<satoshi.yagi at yahoo.com>
Please report any bugs or feature requests to bug-net-ssh-tunnel at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-SSH-Tunnel. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-net-ssh-tunnel at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Net::SSH::Tunnel
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-SSH-Tunnel
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-SSH-Tunnel
CPAN Ratings
http://cpanratings.perl.org/d/Net-SSH-Tunnel
Search CPAN
http://search.cpan.org/dist/Net-SSH-Tunnel/
Copyright 2012 Satoshi Yagi.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Net::SSH::Tunnel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SSH::Tunnel
CPAN shell
perl -MCPAN -e shell install Net::SSH::Tunnel
For more information on module installation, please visit the detailed CPAN module installation guide.