Skip to content

jonyesno/sshplex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sshplex

Overview

sshplex is just another SSH multiplexer that sends commands to multiple target hosts and gathers their outputs.

You know, the one you've written countless times yourself. This is my most recent attempt that scratches my particular itches and replaces previous efforts.

Features

  • Can operate in either exec and shell mode, whichever suits your needs

  • Pure Ruby, no linking to libssh or libcrypto

  • That's it

Shell mode

When a SSH channel is in shell mode you don't know when a command is complete. Instead, you watch the output for your shell's prompt to reappear. With a regex. This is somewhat fragile.

Host lists and filtering

Hosts are specified in two ways

  • as a list on the command line

eg:

% sshplex db01.zomo.co.uk db02.zomo.co.uk
  • from a file passed as the --hosts parameter

In this second form further command line arguments are treated as regular expression alternatives to filter the provided host lists. During the sshplex session this filter can be further revised using the :on control command.

eg:

% sshplex --hosts server.list db proxy

would filter server.list using the regular expression (db|proxy) and limit the sshplex session to those hosts.

Requirements

Ruby, Bundler. See Gemfile

Thanks

Thanks to Jamis Buck and contributors for Net::SSH.

Example

% bundle exec ./sshplex -A mon.zomo.co.uk ns0.zomo.co.uk
sshplex% df -h
[mon.zomo.co.uk] # exec: df -h
[ns0.zomo.co.uk] # exec: df -h
[ns0.zomo.co.uk] Filesystem      Size    Used   Avail Capacity  Mounted on
[ns0.zomo.co.uk] /dev/vtbd0p2    9.2G    6.3G    2.1G    75%    /
[ns0.zomo.co.uk] devfs           1.0K    1.0K      0B   100%    /dev
[ns0.zomo.co.uk] # exit: 0
[mon.zomo.co.uk] Filesystem      Size    Used   Avail Capacity  Mounted on
[mon.zomo.co.uk] /dev/vtbd0p3    108G     75G     24G    75%    /
[mon.zomo.co.uk] devfs           1.0K    1.0K      0B   100%    /dev
[mon.zomo.co.uk] # exit: 0

License

Relesed under MIT license, see LICENSE. Non-warranty in there too.

Author

Jon Stuart, Zikomo Technology, 2023

About

SSH multiplexer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages