The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Appliance::Session::Transport::SSH

SYNOPSIS

 $s = Net::Appliance::Session->new(
    Host      => 'hostname.example',
    Transport => 'SSH',
 );

 $s->connect(
    Name     => $username, # required
    Password => $password, # required if logging in
 );

DESCRIPTION

This package sets up a new pseudo terminal, connected to an SSH client running in a spawned process, which is then bound into Net::Telnet for IO purposes.

CONFIGURATION

This module hooks into Net::Appliance::Session via its connect() method. Parameters are supplied to connect() in a hash of named arguments.

Prerequisites

Before calling connect() you must have set the Host key in your Net::Appliance::Session object, either via the named parameter to new() or the host() object method inherited from Net::Telnet.

Required Parameters

Name

A username must be passed in the Name parameter otherwise the call will die. This value is stored for possible later use by begin_privileged().

Password

If log-in is enabled (i.e. you have not disabled this via do_login()) then you must also supply a password in the Password parameter value. The password will be stored for possible later use by begin_privileged().

Optional Parameters

SHKC

Setting the value for this key to any False value will disable openssh's Strict Host Key Checking. See the openssh documentation for further details. This might be useful where you are connecting to appliances for which an entry does not yet exist in your known_hosts file, and you do not wish to be interactively prompted to add it.

 $s->connect(
    Name     => $username,
    Password => $password,
    SHKC     => 0,
 );

The default operation is to let openssh use its default setting for StrictHostKeyChecking. You can also set this option to true, of course.

App

You can override the default location of your SSH application binary by providing a value to this named parameter. This module expects that the binary is a version of OpenSSH.

 $s->connect(
    Name     => $username,
    Password => $password,
    App      => '/usr/local/bin/openssh',
 );

The default binary location is /usr/bin/ssh.

Opts

If you want to pass any other options to openssh on its command line, then use this option. Opts should be an array reference, and each item in the array will be passed to openssh, separated by a singe space character. For example:

 $s->connect(
    Name     => $username,
    Password => $password,
    Opts     => [
        '-p', '222',            # connect to non-standard port on remote host
        '-o', 'CheckHostIP=no', # don't check host IP in known_hosts file
    ],
 );

DEPENDENCIES

To be used, this module requires that your system have a working copy of the OpenSSH SSH client application installed.

AUTHOR

Oliver Gorwits <oliver.gorwits@oucs.ox.ac.uk>

COPYRIGHT & LICENSE

Copyright (c) The University of Oxford 2006. All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA