net::ssh::Perl connecting to f-secure ssh server

net::ssh::Perl connecting to f-secure ssh server

am 10.10.2007 10:07:30 von Tweetie Pooh

Hi,

I asked this on the wonderful Perlmonks site and am repeating here incase
the one with the answer is here and not there....

We need to write a script that will connect to a softswitch (Ericsson),
run commands retrieving output to files and sometimes using some of that
output as parameters to more commands.

The softswitch runs on Windows NT server and uses F-Secure 3.2.0. The
client box will be Solaris with Perl 5.8.8.

I can run ssh from the shell and connect OK. I can run the "commands"
and see output on screen.

I have started to write a demo in Perl and I can login fine, using ssh->
shell() I can see the post login welcome and the "shell" promp (oddchar +
<). If I go interactive I can see my input on the screen but no response
from server. If I send commands I get an error.

#!/usr/local/bin/perl -w
use strict;
use Net::SSH::Perl;

my $ssh = Net::SSH::Perl->new("host",
(protocol=>'2',port=>'52000',debug=>'true'));
$ssh->login("user","pass");
$ssh->cmd("exit;");

Gives lots of debug info showing attempt to use key files etc all fail
(OK) then using password. I get a login completed.

prospero: Next method to try is password.
prospero: Trying password authentication.
prospero: Login completed, opening dummy shell channel.
prospero: channel 0: new [client-session]
prospero: Requesting channel_open for channel 0.
prospero: channel 0: open confirm rwindow 100000 rmax 16384
prospero: Got channel open confirmation, requesting shell.
prospero: Requesting service shell on channel 0.
prospero: channel 1: new [client-session]
prospero: Requesting channel_open for channel 1.
prospero: Entering interactive session.
prospero: Sending command: exit;
prospero: Requesting service exec on channel 1.
prospero: channel 1: open confirm rwindow 100000 rmax 16384

Then it waits. If I press ENTER

Received disconnect message: Window overflow received channel data.
at /usr/local/lib/perl5/site_perl/5.8.8/Net/SSH/Perl/SSH2.pm line 284

Ideas much appreciated.

I don't need a great deal of fancy stuff. The commands and output are
pretty fixed, no real nasties like running passwd.

I am using Protocol 2 (only), 1 doesn't even log in.

I have cobbled something similar in Java and get similar results, ie I
login, sometimes see the prompt but that's it.

Note that I am effectively connecting to an application rather than a
true shell.

Re: net::ssh::Perl connecting to f-secure ssh server

am 13.10.2007 21:34:43 von Tweetie Pooh

Tweetie Pooh wrote in
news:Xns99C55D150BE6BTweetiePooh@62.253.170.163:

> Hi,
>
> I asked this on the wonderful Perlmonks site and am repeating here
> incase the one with the answer is here and not there....
>
> We need to write a script that will connect to a softswitch
> (Ericsson), run commands retrieving output to files and sometimes
> using some of that output as parameters to more commands.
>
> The softswitch runs on Windows NT server and uses F-Secure 3.2.0. The
> client box will be Solaris with Perl 5.8.8.

>
> Note that I am effectively connecting to an application rather than a
> true shell.
>

For information I have a solution. Tried Net::SSH::Expect and hit same
issue but this module has a method to change the command terminator and
comments that some systems want to see a \r\n rather than the normal \n on
Unix boxen. Tried this and it works. Flipping windows.

PTL