waitssh

1.0.5 • Public • Published

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);
}

Readme

Keywords

Package Sidebar

Install

npm i waitssh

Weekly Downloads

4

Version

1.0.5

License

Apache-2.0

Unpacked Size

15.6 kB

Total Files

4

Last publish

Collaborators

  • chris.parnin
  • ssmirr