[Ssh-sftp-perl-users] Slow Authentication
Brought to you by:
dbrobins
From: Eric L. <net...@er...> - 2005-07-04 22:11:59
|
I'm having some trouble with slow logins using Net::SSH::Perl. I've used = the module on other machines in the past and love what I can do with it, = but the slow authentication I'm seeing currently is a pain.=20 I'm using Perl 5.8.0 with the latest versions of the modules downloaded = from CPAN. Machine is a dual XEON with 64 Bit Redhat Enterprise 3.1 = installed. Tried installing using MCPAN and also manually downloading = and installing each module. Didn't seem to help.=20 To try and narrow things down, I've put a little script together that = simply goes and performs an 'ls' on the remote machine.=20 use strict; use Net::SSH::Perl; use vars qw($ssh); my @ident =3D ( "/home/user/.ssh/id_dsa"); my %params =3D ( protocol =3D> 2, interactive =3D> 0, identity_files =3D> [@ident], debug =3D> 1, options =3D> [ "BatchMode yes", "AuthenticationSuccessMsg no", "ForwardX11 no", "ForwardAgent no" ] ); my $server =3D $ARGV[0]; &sshconnect($server); my ($stdout, $stderr, $exit) =3D $ssh->cmd("ls"); print "$stdout\n"; if (! $ssh) { print "Unable to establish ssh connection to: $server\n"; } else { print "Successfully established ssh connection to: $server\n"; } sub sshconnect { my $server =3D $_[0]; our $ssh =3D Net::SSH::Perl->new("$server", %params); $ssh->login("user"); } Output with the debug flag is as follows: d: Reading configuration data /root/.ssh/config d: Reading configuration data /etc/ssh_config d: Allocated local port 1022. d: Connecting to remote1, port 22. d: Remote protocol version 2.0, remote software version OpenSSH_3.6.1p2 d: Net::SSH::Perl Version 1.28, protocol version 2.0. d: No compat match: OpenSSH_3.6.1p2. d: Connection established. d: Sent key-exchange init (KEXINIT), wait response. d: Algorithms, c->s: 3des-cbc hmac-sha1 none d: Algorithms, s->c: 3des-cbc hmac-sha1 none d: Entering Diffie-Hellman Group 1 key exchange. d: Sent DH public key, waiting for reply. d: Received host key, type 'ssh-dss'. d: Host 'remote1' is known and matches the host key. d: Computing shared secret key. d: Verifying server signature. d: Waiting for NEWKEYS message. d: Enabling incoming encryption/MAC/compression. d: Send NEWKEYS, enable outgoing encryption/MAC/compression. d: Sending request for user-authentication service. d: Service accepted: ssh-userauth. d: Trying empty user-authentication request. d: Authentication methods that can continue: = publickey,password,keyboard-interactive. d: Next method to try is publickey. d: Trying pubkey authentication with key file '/home/user/.ssh/id_dsa' d: Login completed, opening dummy shell channel. d: channel 0: new [client-session] d: Requesting channel_open for channel 0. d: channel 0: open confirm rwindow 0 rmax 32768 d: Got channel open confirmation, requesting shell. d: Requesting service shell on channel 0. d: channel 1: new [client-session] d: Requesting channel_open for channel 1. d: Entering interactive session. d: Sending command: ls d: Requesting service exec on channel 1. d: channel 1: open confirm rwindow 0 rmax 32768 d: input_channel_request: rtype exit-status reply 0 d: channel 1: rcvd eof d: channel 1: output open -> drain d: channel 1: rcvd close d: channel 1: input open -> closed d: channel 1: close_read d: channel 1: obuf empty d: channel 1: output drain -> closed d: channel 1: close_write d: channel 1: send close d: channel 1: full closed authorized_keys sites Successfully established ssh connection to: remote1 The delay seems to happen primarily in two places. First at the line: d: = Algorithms, s->c: 3des-cbc hmac-sha1 none which takes 10 seconds or so, then again at: d: Computing shared secret = key.=20 Which again takes 10 or 15 seconds.=20 Any help would be greatly appreciated. I'd like to not have to rewrite = the whole process to use Net::SSH |