I've long wanted a Net::SSH module (one that doesn't just execute the ssh client). So, partly out of desire for such a module, and partly out of interest in SSH, I wrote such a module.

It's not complete by any means. Currently it has the following restrictions (among others that I'm probably forgetting):

What is working? Well, enough that I can do the following:
use Net::SSH; my $ssh = Net::SSH->new($host); $ssh->login($user, $pass); my($out, $err) = $ssh->cmd($cmd);
If you're interested in trying it out, grab it at http://rhumba.pair.com/ben/perl/Net-SSH-0.01.tar.gz.

The installation is relatively tricky; it's described in the README, but part of the trickiness is because it depends on a module (Crypt::CFB) which doesn't seem to be on CPAN (I bundled it with the tarball), and it requires a patch to Math::GMP (patch included).

I'm going to start working on adding support for some other ciphers and more authentication routines.

I'd really love some feedback on the module, though, so please, if you have a chance, do try it out, and if you have any comments, let me know.

Replies are listed 'Best First'.
Re: New Module: Net::SSH
by btrott (Parson) on Jan 19, 2001 at 11:40 UTC
    In case anyone's interested: I've put out a new version of Net::SSH. The new version is at http://rhumba.pair.com/ben/perl/Net-SSH-0.02.tar.gz.

    The following features have been added:

    • Much better cipher support: now supports DES and 3DES; can specify different ciphers to 'new' method; can only select ciphers supported by sshd server.

    • Better host key support: add unrecognized host keys to user host key file.

    • Nice example script in eg/ dir.
    There are other things, like small fixes etc.

    Sadly the installation is still tricky; in fact I've added *another* module that isn't on CPAN (Crypt::CBC). The module is on CPAN in another form; make sure you don't get that one, because it doesn't seem to be compatible w/ the CBC algorithm in SSH. Use the one included in the 'bndl' directory.

    I have some bug fixes to track down (one is a problem with the rsa session key encryption that only pops up once in a while; could even be an unrelated thing), and then I'll probably start the adding-to-CPAN process.

Re: New Module: Net::SSH
by mirod (Canon) on Jan 11, 2001 at 12:26 UTC

    The main problem I see is that Crypt::IDEA only works on Solaris (according to CPAN Testers and to gcc on my Linux box)

    .

    Too bad because this looks like a really useful module.

      That's weird. It compiled fine for me on redhat 6.2.

      Here's my gcc:

      % gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66 +/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
      Anyway: I will indeed take a look at this. I've no idea why it wouldn't compile; I'm assuming you grabbed the latest version from CPAN? Were the errors similar to those reported in the CPAN Testers report?

      I'm not exactly an expert in C. :)

      And I do mean to add more encryption ciphers; in fact, since there's a pure Perl version of Blowfish, that shouldn't give any problems. Hopefully.

        The version of gcc I use is actually more recent:

        gcc -v Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs gcc version 2.95.3 19991030 (prerelease)

        I am actually really surprised you managed to compile Crypt::IDEA, according to CPAN Testers it needs a patch to work even on Solaris.

        The error I get is:

        IDEA.xs: In function `XS_Crypt__IDEA_crypt': IDEA.xs:66: `sv_undef' undeclared (first use in this function)

        Which might be realted to an earlier warning:

         Please specify prototyping behavior for IDEA.xs (see perlxs manual)

        I don't know enough about xs to do much more here.