Ok it took me a while but I finally have everything working for Net::SSH. Here's the basic portion of the script I'm using and the problem:

use Net::SSH::Perl print "What username?\n"; $username = <STDIN>; chomp$username; print "What password?\n"; $password = <STDIN>; chomp$password; my $cmd = 'get log event'; my $host = 'x.x.x.x'; my $ssh = Net::SSH::Perl->new($host, cipher => DES3, protocol=>1, deb +ug => true, use_pty=>1); $ssh->login($username, $password); my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout
Ok the issue seems to be that the log-in for Netscreen sticks. I'm able to run this same script to a solaris-based box and perform an "ls" for the command and receive output. I've also used the command $ssh->shell after the login and the shell returns. When using debug I notice a few interesting messages which I don't receive when debugging a normal ssh connection. Those messages are as follows:
#1 RSA authentication failed: Can't load public key. #2 Warning: ignoring packet of type 15.
I dont believe this is an RSA authentication error as when I view the log on the Netscreen I see the username/password being authenticated. The other reason I don't believe it's an RSA issue is the fact I can put the $ssh->shell command after the login and the prompt comes up with no problem.

Netscreen gives 2 messages for successful logins, #1 being: "SCS: SSH user X has been authenticated using password from x.x.x.x. Message #2 is: "Admin user X has logged in via SCS from x.x.x.x. When I'm utilizing the script I check the logfiles on the Netscreen from another session and only see message 1. The command also never gets issued as there is a log entry for the command. Perl also just sits. If I add the $ssh->shell or utilize a normal ssh login I get both messages. I'm wondering what could be wrong with my script where the login isn't going all the way through or if Netscreen has some crazy ssh that doesn't work.

Also, SSH-2 doesn't work on Netscreen as it states major protocol versions differ 2 v 1. Any help/ideas much appreciated.

Thanks.

janitored by ybiC: Balanced <code> tags around codeblock & error message, as per Monastery convention.


In reply to Net SSH Module problem with Netscreen by iloveperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.