Skip to content

gdziuba/node-red-nodespect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSH Interactive Node for Node-RED

The NODE-RED-EXPECT-TCL is a set of custom Node-RED nodes designed to establish an interactive SSH session to a remote server. It allows dynamic execution of commands within this session based on input messages, providing flexibility for automation tasks that require SSH connectivity.

Features

  • Dynamic Connection Parameters: Allows SSH connection details (host, port, username, password) to be specified dynamically via input messages, with the option to fall back on static configurations.
  • Interactive Session Management: Maintains an interactive SSH session, enabling the execution of multiple commands in the context of a single, persistent session.
  • Connection Status Feedback: Provides visual feedback within the Node-RED editor on the connection status, changing node color to indicate when the session is connected or disconnected.

Installation

git clone
cd node-red-nodespect
npm install

Pallet Manager to come

Usage

  1. Configuration: Drag the SSH Connection Open into your flow. Optionally, configure static default connection parameters (host, username, password, port, privatekey, passkey) in the node's settings if you want to have fallback values.

  2. Dynamic Parameters: Send an input message to the node with payload properties specifying host, port, username, password, privateKey, and/or passphrase for dynamic connection setup. Example message payload for dynamic parameters:

    {
      "payload": {
        "host": "example.com",
        "port": 22,
        "username": "user",
        "password": "password",
        "privateKey": "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----",
        "passphrase": "password"
      }
    }
  3. Executing Commands: Once connected, send additional input messages with the payload.command property set to the command you wish to execute on the remote SSH server. The node maintains the session for subsequent commands.

  4. Connection Status: Monitor the node's status in the Node-RED editor for connection feedback. A green node indicates an active connection, while red signifies disconnected.

  5. Session Closure: To close the session, either deploy changes, stop the flow, or send a command to explicitly exit the session if needed.

Security Considerations

  • Handle sensitive information like passwords with care. Prefer dynamic input for sensitive details and secure the flow of these messages within your Node-RED environment.
  • Consider using SSH keys for authentication where possible for enhanced security.

Dependencies

  • Requires the ssh2 npm package for SSH connectivity.

License

Author

  • Grey Dziuba / GitHub @gdziuba

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published