Skip to content

A utility to manage ssh keys of multiple users on multiple servers

Notifications You must be signed in to change notification settings

SpiceGems/server-man

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Organizing ssh keys of users

  • create a file <username> inside directory called keys and add any number of keys there. A user can have multiple ssh keys.
  • Eg: create a file keys/jake and add any number of keys in the that file. All these keys will be treated as Jake's key

Organizing server list

  • Create a file called servers.js which should export an array of objects
  • Each object can have the following properties
    • host: hostname or IP addreess
    • name: A name to indentify the server.
    • port: Port number ( Optional. default 22 )
    • user: ssh user ( Optional : default: devuser )

Eg

module.exports = [
    {
      name: 'app1Dev',
      host: '8.8.8.8',
    },
    {
      name: 'app1Staging',
      host: '8.8.8.9',
    },
];

Adding removing ssh keys

CLI interface

  1. list currently loaded server names and usernames

npx ssh-access-manager -a

  1. list status of all servers.

npx ssh-access-manager -l

  1. grant access to username 'jake' on server called 'devserver'

npx ssh-access-manager -n devserver -g jake

  1. set access of server 'devserver' to user 'jake' only

npx ssh-access-manager -n devserver -s jake

  1. revoke access to username 'jake' on server called 'devserver'

npx ssh-access-manager -n devserver -r jake

  1. Dump curret Access-Control-List ( ACL ) for servers. ( Ie, simply dump output of -l command as json )

npx ssh-access-manager -l -j

  1. Update server access from acl.js file.

npx ssh-access-manager -U

We can create a acl.js file by simply dumping current state in all the servers.

npx ssh-access-manager -l -j >> acl.json

API usage

var server = new Server( [ 'devuser@8.8.8.8', 1122 ] );

// list the usernames in the server
server.listAccess(); // -> Promise( Array<String> )

server.grantAccess( 'hari' ); // -> Promise( Array<String> )

server.revokeAccess( 'hari' ); // -> Promise( Array<String> )

server.setAccess( 'hari' ); // -> Promise( Array<String> )

About

A utility to manage ssh keys of multiple users on multiple servers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published