npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ssh2-keeper

v1.2.3

Published

To store your SSH2 servers connection information allowing to connect to them quickly

Downloads

2

Readme

Build Status Code Climate Test Coverage Issue Count

ssh2-keeper

Greenkeeper badge FOSSA Status Store servers with tags, simple search to use as SSH2 connections

Why this project?

Using an OSx (or Linux) environment, when you need to manage lot of servers it could be difficult to remember all the hostnames or ip addresses. On the Windows system I used to use mRemote, but I didn't find anything similar on OSx/Linux. That's the idea to create a simple CLI program allowing to store all the connection information using tags (like mRemote does).

How to install the lib

Install using NPM package

To install you can simply using the latest version of the package deployed on the npmjs.org repository. For this simply use the following command:

npm install -g ssh2-keeper

You will see the following output:

/Users/Marco/.nvm/versions/node/v11.14.0/bin/sk -> /Users/Marco/.nvm/versions/node/v11.14.0/lib/node_modules/ssh2-keeper/index.js
+ [email protected]
updated 1 package in 20.563s

Configuration

Using the folder in the output of the installation output, you can configure with the desired parameters. The file is inside the config folder. In my example it is /Users/Marco/.nvm/versions/node/v11.14.0/lib/node_modules/ssh2-keeper/config/default.json

{
  "db_path": "/Users/mmornati/ssh2-keeper",
  "server_collection": "servers",
  "tag_collection": "tags",
  "default_username": "mmornati",
  "show_ssh_command": true
}

You just need to select the db_path part with the information you need.

Install using the sources

It's a NodeJS project and actually it is not available on the npm repository. So, the better way is downloading sources from github and install globally from sources:

git clone https://github.com/mmornati/ssh2-keeper.git
cd ssk-keeper
npm install -g .

Installation Image

The ssh2-keeper is now available as sk command on your system.

Configuration

After the global installation the configuration folder is into the global node modules installation folder. You can check which one is on your system using:

npm root -g

Node Modules Folder

On my system for example, the global folder is /usr/local/lib/node_modules which means, after the ssh2-keeper installation, the configuration folder will be /usr/local/lib/node_modules/ssh2-keeper/config. Inside this latest one you will find a default.json file and you must configure the database folder.

{
  "db_path": "/Users/mmornati/ssh2-keeper",
  "server_collection": "servers",
  "tag_collection": "tags",
  "default_username": "mmornati",
  "show_ssh_command": true
}

Usage

If you globally installed the module, using sk --help allow you to retrieve the script documentation.

Successfully connected to : ./db
USAGE: node sk [OPTION1] [OPTION2]... arg1 arg2...
The following options are supported:
  -v, --verbose <ARG1>       	Show verbose log
  -t, --tag <ARG1>           	Tag(s) to allow you to find server (multiple)
  -h, --hostname <ARG1>      	Hostname of your server
  -a, --admin_server <ARG1>  	If you need to connect to an Admin server to reach your target. Ex: ssh -tt [email protected] ssh -tt [email protected]
  -i, --ip <ARG1>            	Server IP address.
  -f, --identity_file <ARG1> 	Identity File
  -u, --username <ARG1>      	Username to connect to your server. If empty the one in configuration file be used
  -o, --operation <ARG1>     	One of ADD, SEARCH, UPDATE or REMOVE

Add a new server

sk -o add -h server35.mornati.net -i 192.168.100.35 -t jenkins -t slave -t slave04 -t integration

This will add a server (if the hostname it is not already present with the same hostname) with the provided parameters and tags.

Update using add

With a line like the previous one we've seen, you can also update server parameters:

sk -o add -h server35.mornati.net -i 192.168.100.39

In this way, for example, if the server was already present into database, you will update the IP address. All others information already present into database will be kept. In the same way you can add a new tag to the server

sk -o add -h server35.mornati.net -t mypersonalserver

will add a new tag to the server (if not already present).

Update Tags

Update

Using the Update operation you can update a single server, using the hostname, or update all the servers related to a tag.

~ sk -o update -h server20.mornati.net -u marco -f ~/.ssh/test_rsa

Using a tag, like in the followind example:

~ sk -o update -t www -u mmornati -f ~/.ssh/test2_rsa

It will search foll all the servers tagged with www and set to anyone mmornati as username and ~/.ssh/test2_rsa as identity file.

This command will update the server20.mornati.net putting marco as username and ~/.ssh/test_rsa as identity file

Search

The most used function will surely be the search one. You can search a server using the hostname, which will provide you the list of data known about the server:

~ sk -o search -h server20.mornati.net
Successfully connected to : ./db
{ hostname: 'server20.mornati.net',
  ip: '192.168.100.20',
  tags: [ 'www', 'front', 'front02', 'preprod', 'france' ],
  _id: '15404e5a1b134cb289ffae0cc89968ca' }
Added to clipboard

Search by Hostname

Or you can search using tags: it will return you the intersection between all provided tags.

~ sk -o search -t prod -t front -t italy
Successfully connected to : ./db
ssh [email protected]
ssh [email protected]

It will return you all the 'front' and 'prod' servers for 'italy' (servers must have the 3 tags to be into the list). When the list gives you a single result, the ssh command will be directly in your clipboard: with a simple CTRL+V you can use it! :)

Search improved

As I said before, this one is the most used function, I created an 'undocumented' function allowing you to search in this way:

~ sk search prod front01 italy
Successfully connected to : ./db
ssh [email protected]
Added to clipboard

So, without providing the option name. In this case:

  • the first argument is the operation (SEARCH, ADD)
  • if it is SEARCH from the second arguments all others will be consider as tags
  • if it is ADD the second argument is the hostname and all others are tags

Search Prod Italy

Search by Steps

Tips

To initialize my work environment database I used 'spreadsheet' (yes, it is amazing, but it was quick!).

Spreadsheet

I just copied hostnames and IPs I had on another document, and then, using the spreadsheet's CONCATENATE function I was able to generate the list of 'ADD' commands.

Server with proxy

If you are using an admin server between you PC and the target server (for example on the configuration environment) you can store this information into the database (admin_server) and the ssh command sent by the ssh2-keeper will be ready to use.

sk search preprod france front02
Successfully connected to : ./db
ssh -tt [email protected] ssh -tt [email protected]
Added to clipboard

Next Steps

  • What you need to improve it :)

License

FOSSA Status