Skip to content

ottomatica/waitssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

waitssh

waitssh is a cross-platform utility that waits for ssh to become available.

One common use case is for waiting for Virtual Machines to boot and waiting for sshd to be ready. Other tools, such as wait-on are agnostic to the network setup and will fail in cases such as port-forwarding.

Implementation

How does it work? waitssh implements the first phase of the SSH protocol specification, described in RFC 4253. Immediately after the TCP connection is established, and before negotiating the cryptography, both ends send an identification string:

SSH-protoversion-softwareversion SP comments CR LF

waitssh open a socket, attempts to write send a client version string to the ssh sever. waitssh gracefully handles ECONNRESET errors and reconnects as needed until the server responses with the appropriate version string.

Using waitssh

waitssh does not need authentication information to verify the ssh connection being ready, only the hostname and port.

const waitssh = require('waitssh');
let sshInfo = {port: 2002, hostname: 'localhost'}
try {
    await waitssh(sshInfo);
} catch (error) {
    console.error(error);
    process.exit(1);
}

About

⏱ Cross-platform utility to wait for ssh to become available

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •