csshX with lincastor on Mac

Problem Statement: I want to SSH into a list of hosts from the browser(from a host monitoring UI).

Note: At this point of time, we did not have Service Discovery present.

To identify this, in our team, we maintained a single service which has this list. The service is responsible for bunch of things including displaying host metrics, checking health statuses, disk space, querying the LB status for the service/port.

A regular deployment usually consists of updating a puppet script and running a puppet command on all servers in batches of 20% at a time. When you start dealing with multiple hosts, you realize you want to use a utility command like csshX which opens multiple windows. Though this is limited by the configuration file or copy/pasting the host list.

I wanted to pass on this host list data from the browser and with a click of a link, the user should be able to get the list of hosts.

A Solution was to use LinCastor, a Mac utility where you can register your own protocol with your multi ssh utility.

Once, you register the csshx protocol.

## To install csshX
brew install csshX

Open LinCastor App

Add new Scheme Title: csshX schemes: csshx

select Shell. Add this line before exit 0

/usr/local/bin/csshX $URL_VALUE

Now if you have a link like csshx://127.0.0.1%20127.0.0.2%20127.0.0.3 , it will open 3 shells using the csshX command installed passing it as csshX 127.0.0.1 127.0.0.2 127.0.0.3. The protocol handler transfers the ownership in a very clean way.

Security Warning: Beware about any URL injections that may happen while using this. As long as you trust the source, you should be good.

 
comments powered by Disqus