Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Net::SSH::Perl ConnectTimeout (ssh -o option)

by neilwatson (Curate)
on Aug 10, 2006 at 13:49 UTC ( #566623=note: print w/ replies, xml ) Need Help??


in reply to Net::SSH::Perl ConnectTimeout (ssh -o option)

Looking at the source code, the ToDo file, reveals that this is not yet finished:

$Id: ToDo,v 1.22 2003/12/03 15:35:21 autarch Exp $ Add more tests to the test suite; add SSH2 tests. Fixes to SSH2 implementation: * get rid of dummy shell channel (if possible) * more documentation * anything currently marked XXX in the code Compatibility with NetScreen? Switch over to using Crypt::RSA for SSH1 RSA implementation? SSH2 RSA keys now use Crypt::RSA; at this point it might just be too much extra baggage to try to force people to use Crypt::RSA, because it has so many prereqs. Switch completely to Math::Pari? Worthwhile? Again, don't want existing SSH1 users to have to switch. Use non-blocking connect, like IO::Socket, to implement a connect Timeout. A proper scp client. Port forwarding.

Neil Watson
watson-wilson.ca


Comment on Re: Net::SSH::Perl ConnectTimeout (ssh -o option)
Download Code
Replies are listed 'Best First'.
Re^2: Net::SSH::Perl ConnectTimeout (ssh -o option)
by codejerk (Initiate) on Aug 10, 2006 at 14:26 UTC
    very true. Because this module is unfinished, has anyone managed to use a workaround or modification to (at least temporarily... I'm sure btrott will get back to this module soon) implement a connect timeout?
    to summarize:
    • Net::SSH::Perl is unfinished.
    • Net::SSH::Perl does not yet have an implementation of the SSH ConnectTimeout option.
    • I am searching for a quick, temporary solution to this "feature hole"

    If anyone can assist, I will greatly appreciate the input :)
      This is a very late reply, but this has still not been implemented. I added the following to Perl.pm, right after the socket creation to give me a send/receive timeout of 10 seconds:

      setsockopt($sock, SOL_SOCKET, SO_SNDTIMEO, pack('LL', 10, 0) ) or die $!;
      setsockopt($sock, SOL_SOCKET, SO_RCVTIMEO, pack('LL', 10, 0) ) or die $!;

      Hope that helps.
      --mf
        This work-around almost solved my problem -- but my time_t was a 64-bit integer. I believe that pack("L!L!",...) is more portable in this case.
        Well this workaround is for timeout while creating SSH object or the timeout is applicable while executing a SSH command using that object. Will it die if there is no response from the command.
        Thanks
      Hi folks, I would like to know if there is a way to get time taken for each step in debug mode to be displayed to find out which step is taking the longer time. Net::SSH::Perl Version 1.35, protocol version 2.0, running in debug mode I have the following timeout issue at times and would like to get UNIX time displayed besides the sourceserver like following for each debug line. Thanks.
      sourceserver unixtime: Reading configuration data /usr/local/apps/.ssh +/config sourceserver unixtime: Reading configuration data /etc/ssh_config sourceserver unixtime: Connecting to targetserver, port 22. sourceserver etc: Remote protocol version 2.0, remote software version + OpenSSH_4.3 sourceserver: Net::SSH::Perl Version 1.35, protocol version 2.0. sourceserver: No compat match: OpenSSH_4.3. sourceserver: Connection established. sourceserver: Sent key-exchange init (KEXINIT), wait response. sourceserver: Algorithms, c->s: 3des-cbc hmac-sha1 none sourceserver: Algorithms, s->c: 3des-cbc hmac-sha1 none sourceserver: Entering Diffie-Hellman Group 1 key exchange. sourceserver: Sent DH public key, waiting for reply. sourceserver: Received host key, type 'ssh-dss'. sourceserver: Host 'targetserver' is known and matches the host key. sourceserver: Computing shared secret key. sourceserver: Verifying server signature. sourceserver: Waiting for NEWKEYS message. sourceserver: Send NEWKEYS. sourceserver: Enabling encryption/MAC/compression. sourceserver: Sending request for user-authentication service. sourceserver: Service accepted: ssh-userauth. sourceserver: Trying empty user-authentication request. sourceserver: Authentication methods that can continue: publickey,gssa +pi-w ith-mic,password,keyboard-interactive. sourceserver: Next method to try is publickey. sourceserver: Next method to try is password. sourceserver: Trying password authentication. Taking too long to complete. Timed out after 60 seconds.
        The easiest solution would probably be to just patch or to redefine the module debug function.

        Another, less intrusive, option is to tie STDERR to an object that prepends the current time to every printed line.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://566623]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2015-08-01 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found
    past polls