|Posted on 2005-09-07 18:27:23-07 by feckusine|
|When using RSA keys, it's taking way too long to exchange,execute...|
When I supply $password within the script it works perfectly. When I setup RSA keys on the host and turn on debug mode, it lags when it reaches:
"box: Algorithms, s->c: 3des-cbc hmac-sha1 none"
for about 60 seconds, then it lags again when it reaches:
"box: Computing shared secret key."
for roughly another 45 seconds...
Here's my debug output:
[mysql@box admin]$ time ./ssh.pl box: Reading configuration data /home/mysql/.ssh/config box: Reading configuration data /etc/ssh_config box: Connecting to sat-appprod0, port 22. box: Remote protocol version 1.99, remote software version OpenSSH_3.1p1 box: Net::SSH::Perl Version 1.28, protocol version 2.0. box: No compat match: OpenSSH_3.1p1. box: Connection established. box: Sent key-exchange init (KEXINIT), wait response. box: Algorithms, c->s: 3des-cbc hmac-sha1 none box: Algorithms, s->c: 3des-cbc hmac-sha1 none box: Entering Diffie-Hellman Group 1 key exchange. box: Sent DH public key, waiting for reply. box: Received host key, type 'ssh-dss'. box: Host 'remotebox' is known and matches the host key. box: Computing shared secret key. box: Verifying server signature. box: Waiting for NEWKEYS message. box: Enabling incoming encryption/MAC/compression. box: Send NEWKEYS, enable outgoing encryption/MAC/compression. box: Sending request for user-authentication service. box: Service accepted: ssh-userauth. box: Trying empty user-authentication request. box: Authentication methods that can continue: publickey,password,keyboard-interactive. box: Next method to try is publickey. box: Trying pubkey authentication with key file '/home/mysql/.ssh/id_rsa' box: Login completed, opening dummy shell channel. box: channel 0: new [client-session] box: Requesting channel_open for channel 0. box: channel 0: open confirm rwindow 0 rmax 32768 box: Got channel open confirmation, requesting shell. box: Requesting service shell on channel 0. box: channel 1: new [client-session] box: Requesting channel_open for channel 1. box: Entering interactive session. box: Sending command: w box: Requesting service exec on channel 1. box: channel 1: open confirm rwindow 0 rmax 32768 box: channel 1: rcvd eof box: channel 1: output open -> drain box: input_channel_request: rtype exit-status reply 0 box: channel 1: rcvd close box: channel 1: input open -> closed box: channel 1: close_read box: channel 1: obuf empty box: channel 1: output drain -> closed box: channel 1: close_write box: channel 1: send close box: channel 1: full closed 1:08pm up 29 days, 19:55, 1 users, load average: 0.46, 0.54, 0.61 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT someuser pts/2 - 8:47am 2:23m 0.05s 0.05s -bash real 1m59.037s user 1m1.360s sys 0m0.050s [mysql@box admin]$
Here's the script I'm executing:
#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; use bytes; my $host = "remotebox"; my $user = "someuser"; my $cmd = "w\n"; my $ssh = Net::SSH::Perl->new($host, debug=>1, protocol=>'2,1', options=>[ "IdentityFile ~/.ssh/id_rsa", "UserKnownHostsFile ~/.ssh/known_hosts"] ); $ssh->login($user); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print "$stdout" if($stdout); print "$stderr" if($stderr); print "$exit" if($exit);
I've been trying to debug this for 3 days now, any help would be greatly appreciated... I would use Net::SSH or Expect but they don't support STDERR like this module does.
|Direct Responses: 990 | 1159 | 4806 | Write a response|