Subject: | Net:SSH::Perl connection issues when ssh-agent had died unexpectedly |
I had trouble with ssh connection creation when my ssh-agent had died after it had exported the SSH_AUTH_SOCK and SSH2_AUTH_SOCK variables. SSH found the variables and tried to ask the agent for an identity but ssh died with "Error reading response length from auth socket" message which was not the most descriptive message. Sometimes I just got a broken pipe.
It took me days to figure this one out. I guess that a bit more informative error messages could save some trouble in the future. I had to backtrace the connection creation logic from PublicKey.pm (where the error initially took place) to Auth.pm and Agent.pm
here's a debug trace from one execution:
sol8dev: Reading configuration data /home/cpt2jmo/.ssh/config
sol8dev: Reading configuration data /etc/ssh_config
sol8dev: Connecting to 10.28.8.10, port 22.
sol8dev: Remote protocol version 2.0, remote software version 3.2.0 SSH Secure Shell
sol8dev: Net::SSH::Perl Version 1.23, protocol version 2.0.
.ol8dev: No compat match: 3.2.0 SSH Secure Shell
sol8dev: Connection established.
sol8dev: Sent key-exchange init (KEXINIT), wait response.
sol8dev: Algorithms, c->s: blowfish-cbc hmac-sha1 none
sol8dev: Algorithms, s->c: blowfish-cbc hmac-sha1 none
sol8dev: Entering Diffie-Hellman Group 1 key exchange.
sol8dev: Sent DH public key, waiting for reply.
sol8dev: Received host key, type 'ssh-dss'.
sol8dev: Permanently added '10.28.8.10' to the list of known hosts.
sol8dev: Computing shared secret key.
sol8dev: Verifying server signature.
sol8dev: Waiting for NEWKEYS message.
sol8dev: Enabling incoming encryption/MAC/compression.
sol8dev: Send NEWKEYS, enable outgoing encryption/MAC/compression.
sol8dev: Sending request for user-authentication service.
sol8dev: Service accepted: ssh-userauth.
sol8dev: Trying empty user-authentication request.
sol8dev: Authentication methods that can continue: publickey,password.
sol8dev: Next method to try is publickey.
Broken Pipe
The program failed in Net/SSH/Perl/Auth/PublicKey.pm line 59 and to be more specific in function Agent->request (Net/SSH/Perl/Agent.pm line 46) when sysread couldn't read anything from the non-existent ssh-agent.
my perl looks like this:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris-thread-multi
uname='sunos sol8dev 5.8 generic_108528-14 sun4u sparc sunw,sun-fire '
config_args='-Dcc=gcc -Dprefix=/vobs/prod/tools/perl/SunOS.test'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O',
cppflags='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='3.1.1', gccosandvers='solaris2.8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib '
libpth=/vobs/prod/tools/gnu/gcc/SunOS/lib /usr/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lrt -lpthread -lc
perllibs=-lsocket -lnsl -ldl -lm -lrt -lpthread -lc
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R /vobs/prod/tools/perl/SunOS.NG/lib/5.8.0/sun4-solaris-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under solaris
Compiled at Dec 13 2002 10:52:10
%ENV:
PERL5LIB="/vobs/prod/AMD/ftpcopy/lib/SunOS:/vobs/prod/AMD/ftpcopy/lib/SunOS/lib:/vobs/prod/AMD/ftpcopy/lib/SunOS/lib/site_perl/5.8.0:"
@INC:
/vobs/prod/AMD/ftpcopy/lib/SunOS/5.8.0/sun4-solaris-thread-multi
/vobs/prod/AMD/ftpcopy/lib/SunOS/5.8.0
/vobs/prod/AMD/ftpcopy/lib/SunOS
/vobs/prod/AMD/ftpcopy/lib/SunOS/lib/5.8.0/sun4-solaris-thread-multi
/vobs/prod/AMD/ftpcopy/lib/SunOS/lib/5.8.0
/vobs/prod/AMD/ftpcopy/lib/SunOS/lib
/vobs/prod/AMD/ftpcopy/lib/SunOS/lib/site_perl/5.8.0/sun4-solaris-thread-multi
/vobs/prod/AMD/ftpcopy/lib/SunOS/lib/site_perl/5.8.0
/vobs/prod/tools/perl/SunOS.NG/lib/5.8.0/sun4-solaris-thread-multi
/vobs/prod/tools/perl/SunOS.NG/lib/5.8.0
/vobs/prod/tools/perl/SunOS.NG/lib/site_perl/5.8.0/sun4-solaris-thread-multi
/vobs/prod/tools/perl/SunOS.NG/lib/site_perl/5.8.0
/vobs/prod/tools/perl/SunOS.NG/lib/site_perl
and my platform is: SunOS sol8dev 5.8 Generic_108528-14 sun4u sparc
best regards,
/jUSSi