ssh-access-manager
v1.2.2
Published
Manage user access on multiple ssh servers.
Downloads
1
Readme
Organizing ssh keys of users
- create a file
<username>
inside directory calledkeys
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 addreessname:
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
- list currently loaded server names and usernames
npx ssh-access-manager -a
- list status of all servers.
npx ssh-access-manager -l
- grant access to username 'jake' on server called 'devserver'
npx ssh-access-manager -n devserver -g jake
- set access of server 'devserver' to user 'jake' only
npx ssh-access-manager -n devserver -s jake
- revoke access to username 'jake' on server called 'devserver'
npx ssh-access-manager -n devserver -r jake
- Dump curret Access-Control-List ( ACL ) for servers. ( Ie, simply dump output of
-l
command as json )
npx ssh-access-manager -l -j
- 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( [ '[email protected]', 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> )