Concurrent ssh client

Build Status Go Report Card GoDoc

go-cs

Concurrent ssh client

cs is a program for concurrently executing local or remote commands on multiple hosts. It is using OpenSSH for running remote commands. Its main purpose is to help automate and manage large network of hosts. So in essence this tool is very similar to Ansible, Chef or Puppet, but much more simpler and faster in execution. Speed and simplicity are its main goals.

Install

Go get

$ go get github.com/akosela/go-cs/cs
# ln -s $GOPATH/bin/cs /usr/bin/cs

Linux (rpm)

$ curl -OL https://github.com/akosela/go-cs/releases/download/v0.9/go-cs-0.9-1.x86_64.rpm
# rpm -ivh go-cs-0.9-1.x86_64.rpm

CRUX

Package

$ curl -OL https://github.com/akosela/go-cs/releases/download/v0.9/go-cs-0.9-1.pkg.tar.xz
# mv go-cs-0.9-1.pkg.tar.xz go-cs#0.9-1.pkg.tar.xz
# pkgadd go-cs#0.9-1.pkg.tar.xz

Port

$ httpup sync https://raw.githubusercontent.com/akosela/crux-ports/master/#go-cs go-cs
# cd go-cs
# pkgmk -i -d

Linux

$ curl -OL https://github.com/akosela/go-cs/releases/download/v0.9/go-cs-0.9.linux.tar.gz
$ tar xvf go-cs-0.9.linux.tar.gz
$ cd go-cs
$ gzip cs.1
# cp cs /usr/bin ; cp cs.1.gz /usr/share/man/man1

FreeBSD

Package

# pkg install go-cs

Port

# cd /usr/ports/net/go-cs
# make install clean

OpenBSD

Package

# pkg_add go-cs

Port

# cd /usr/ports/sysutils/go-cs
# make install clean

MacOS

$ curl -OL https://github.com/akosela/go-cs/releases/download/v0.9/go-cs-0.9.darwin.tar.gz
$ tar xvf go-cs-0.9.darwin.tar.gz
$ cd go-cs
$ gzip cs.1
# cp cs /opt/local/bin ; cp cs.1.gz /opt/local/share/man/man1

Man page

CS(1)                      BSD General Commands Manual                   CS(1)

NAME
     cs - concurrent ssh client

SYNOPSIS
     cs [-emqrstuVv1] [-c file] [-cmd] [-cname] [-d file] [-dd] [-du path]
        [-f script.sh] [-h hosts_file] [-hba] [-i identity_file] [-io] [-ip]
        [-l login_name] [-lip] [-mx] [-nc] [-nmap] [-ns] [-o output_file]
	[-P port] [-p path] [-ping] [-soa] [-to timeout] [-top] [-tr] [-tri]
	[-uname] [-vm] [command] [[user@]host] ...

DESCRIPTION
     cs is a program for concurrently executing local or remote commands on
     multiple hosts.  It is using OpenSSH for running remote commands.  Its
     main purpose is to help automate and manage large network of hosts.

     The options are as follows:

     -c file
             Copy file to the remote machine.

     -cmd    Run an arbitrary local command concurrently on multiple hosts.

     -cname  Run a local DNS query of type CNAME.

     -d file
             Download file from the remote machine.  It will be saved in a
             directory named after the remote host only when you download from
             multiple servers.

     -dd     Prints basic hardware information for a specific host (sudo(8)
             and dmidecode(8) required).

     -du path
     	     Prints the list of largest files in a specific directory (sudo(8) 
	     required, units in M).

     -e      Prints hosts with errors only.

     -f script.sh
             Run a local shell script on the remote host.

     -h hosts_file
             Reads hostnames from the given hosts_file.  Lines in the
             hosts_file can include commented lines beginning with a `#' and
             only one host per line is allowed.

     -hba    Lists installed HBAs and their WWPNs (Linux only).

     -i identity_file
             Selects a file from which the identity (private key) for public
             key authentication is read.  The default is ~/.ssh/id_rsa.

     -io     Run remote iostat(1) on a specific host.

     -ip     Lists network interfaces.

     -l login_name
             Specifies the user to log in as on the remote machine.  This also
             may be specified on a per-host basis on the command line.
     
     -lip    Scans storage interconnects for new luns (Linux only).

     -m      Lists mounted filesystems on a specific host.

     -mx     Run a local DNS query of type MX.

     -nc     Tests specified port with nc(1).  Default is 22/tcp.

     -nmap   Scans host with nmap(1).

     -ns     Run a local DNS query of type NS.

     -o output_file
             Saves standard output and standard error to a file.

     -P port
             Port to connect to on the remote host.

     -p path
             Specifies remote or local path for files in a remote copy or
             download mode.

     -ping   Sends ICMP ECHO_REQUEST to network hosts.

     -q      Quiet mode.  Supresses verbose standard output from remote
             machines.  This mode reports success or failure only.

     -r      Recursively copy entire directories.  It follows symbolic links
             encountered in the tree traversal.

     -s      Sort output.

     -soa    Run a local DNS query of type SOA.

     -t      Force pseudo-tty allocation.	

     -to timeout
             Specifies the timeout (in seconds) used when connecting to the
             SSH server.  The default value is 4 seconds.

     -top    Run remote top(1) in batch mode on a specific host.

     -tr     Run local traceroute(8).

     -tri    Run local traceroute(8) using ICMP (local sudo(8) required).

     -uname  Prints remote system information including OS version.

     -u      Run remote uptime(1) on a specific host.

     -V      Displays the version number and exit.

     -v      Verbose mode.  Causes cs to print debugging messages from ssh(1)
             about its progress.  This is helpful in debugging connection,
             authentication, and configuration problems.  Multiple -v options
             increase the verbosity.  The maximum is 3.

     -vm     Run remote vmstat(8) on a specific host.

     -1      One line mode, useful for sorting output later.

AUTHENTICATION
     The default method for authentication is a public key authentication
     which serves its purpose when dealing with multiple hosts.  You can read
     more about public key authentication in ssh(1).

EXIT STATUS
     The cs utility exits 0 on success, and >0 if an error occurs.

EXAMPLES
     Run a series of commands on hosts foo and bar:

           $ cs 'uptime; uname -a' foo bar

     Run a command on multiple hosts specified in a hosts_file:

           $ cs -h hosts_file uptime

     Run a local shell script on multiple hosts:

           $ cs -f script.sh foo{1..100}

     Run a local shell script with sudo(8) on multiple hosts:

           $ cs -t -f script.sh foo{1..100}

     Copy file to multiple hosts using a specific remote path:

           $ cs -c file -h hosts_file -p /foo/bar

     Download file from host foo:~ to the current working directory:

           $ cs -d file foo

     Download recursively files from /foo/bar from multiple hosts to a speci-
     fic local path /tmp with subdirectories named after remote hosts:

           $ cs -r -d '/foo/bar/*' -h hosts_file -p /tmp

     Run a command on multiple hosts and sort the output:

           $ cs -1 -h hosts_file 'free -m | grep Swap' | sort -rnk4 | head

     Run local ping(1) on multiple hosts:

           $ cs -ping foo{1..100}

     Show name and size of all files matching the glob pattern:

           $ cs -du '/var/log/mes*' foo{1..100}

SEE ALSO
     scp(1), ssh(1), ssh_config(5), sudo(8)

AUTHORS
     Andy Kosela <[email protected]>

BSD                              July 19, 2017                             BSD  
Similar Resources

Tool for monitoring your Ethereum clients. Client-agnostic as it queries the standardized JSON-RPC APIs

Tool for monitoring your Ethereum clients. Client-agnostic as it queries the standardized JSON-RPC APIs

e7mon Tool for monitoring your Ethereum clients. Client-agnostic as it queries the standardized JSON-RPC APIs. However, the execution client should be

Dec 20, 2022

Yet another filecoin secondary retrieval client

Yet another filecoin secondary retrieval client

fcr Yet another filecoin secondary retrieval client FCR is a filecoin secondary retrieval client featured with the ability to participate in an ipld r

Nov 9, 2022

LEO (Low Ethereum Orbit) is an Ethereum Portal Network client.

LEO LEO (Low Ethereum Orbit) is an Ethereum Portal Network client. What makes LEO different from other Portal Network clients is that it uses libp2p f

Apr 19, 2022

A Commander for Go implementation of official Ethereum Client

Young A Commander for Go implementation of official Ethereum Client by zhong-my. Overview Young Dependencies Young stands on the shoulder of many grea

Oct 14, 2021

Package pinentry provides a client to GnuPG's pinentry.

Package pinentry provides a client to GnuPG's pinentry.

Dec 9, 2022

A Binance Smart Chain client based on the go-ethereum fork

A Binance Smart Chain client based on the go-ethereum fork

Dec 31, 2022

A Binance Smart Chain client based on the erigon fork

Erigon Erigon is an implementation of Ethereum (aka "Ethereum client"), on the efficiency frontier, written in Go. System Requirements Usage Getting S

Sep 17, 2022

Go client + OpenAPI v3 spec for Oura-Ring

Oura Ring OpenAPIv3 Schema Definition + Go Client This repo contains an OpenAPIv3 schema definition for OuraRing OuraRing API documentation https://cl

Sep 20, 2022

A project that addresses the creation of RPC (Server-Client) and execute a CRUD in database

RPC - Server/Client A project that addresses the creation of RPC (Server-Client)

Dec 24, 2021
Comments
  • go-cs always uses `ssh -i`, even if not specified by the user

    go-cs always uses `ssh -i`, even if not specified by the user

    The argument parser uses ~/.ssh/id_rsa as the default for the identity file (https://github.com/akosela/go-cs/blob/master/cs/cs.go#L426-L427), so it is passed to SSH even if the user did not specify cs -i ... on the commandline.

    Proposal: Use a null value as the default and do not pass -i to ssh if that null value was not overridden by a cs commandline argument?

  • enhancement: ask user to provide a password

    enhancement: ask user to provide a password

    this is really nice for batch server management. any plan to support user providing a password from shell or as an input option ?

    e.g,

    https://linux.die.net/man/1/pssh

    -A
    --askpass
    Prompt for a password and pass it to ssh. The password may be used for either to unlock a key or for password authentication. The password is transferred in a fairly secure manner (e.g., it will not show up in argument lists). However, be aware that a root user on your system could potentially intercept the password.
    
Related tags
🌰 encrypt/decrypt using ssh keys

ssh-vault ?? encrypt/decrypt using ssh private keys Documentation https://ssh-vault.com Usage $ ssh-vault -h Example: $ echo "secret" | ssh-vault -u

Dec 30, 2022
PKI support for SSH certificates

PKI certificates for SSH Introduction SSH certificates are limited in their usefulness - a certificate can only be signed with a single CA key, so no

Nov 1, 2022
Map ssh-ed25519 keys into x25519 keys

ssh-x22519 ========== The twisted Edwards curve used for ed25519 signatures is birationally equivalent to the Montgomery curve used for x25519: it is

Jan 4, 2023
Uniform interface for interacting with network hardware via telnet/ssh

jgivc/console This package provides a uniform interface for interacting with network hardware via telnet/ssh This package uses part of reiver/go-telne

Dec 9, 2021
The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.

Fabric Smart Client The Fabric Smart Client (FSC, for short) is a new Fabric client-side component whose objective is twofold. FSC aims to simplify th

Dec 14, 2022
Huobi Eco Chain client based on the go-ethereum fork

The Huobi Open Platform is a unified infrastructure platform based on the technical, traffic and ecological resources of the Huobi Group, and will be gradually open to the blockchain industry.

Dec 31, 2022
Yet another Binance Smart Chain client based on TrustFi Network

TrustFi Smart Chain The goal of TrustFi Smart Chain is to bring programmability and interoperability to Binance Chain. In order to embrace the existin

Mar 27, 2021
A phoenix Chain client based on the go-ethereum fork,the new PoA consensus engine is based on the VRF algorithm.

Phoenix Official Golang implementation of the Phoenix protocol. !!!The current version is for testing and developing purposes only!!! Building the sou

Apr 28, 2022
A Go client and CLI for Filecoin Storage Auctions.

go-auctions-client A Go library and CLI to interact with Filecoin Storage Auctions. Join us on our public Slack channel for news, discussions, and sta

Nov 24, 2022
Akroma GO client - Akroma is an EVM based application development platform (smart-contracts).

Akroma Akroma is an EVM based application development platform (smart-contracts). Akroma will utilize a Masternode system, and build out an Oracle pla

Dec 11, 2022