achernet / JumpSSH

Python module to run commands on remote servers through one or more jump servers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JumpSSH

image

image

image

image

image

image

JumpSSH

Python module to run commands on remote servers

Copyright

Copyright (c) 2017 Amadeus sas

License

MIT

Documentation

https://jumpssh.readthedocs.io

Development

https://github.com/AmadeusITGroup/JumpSSH

What

JumpSSH is a module for Python 2.7+/3.5+ that can be used to run commands on remote servers through a gateway.

It is based on paramiko library. It provides the ability to execute commands on hosts that are not directly accessible but only through one or more servers. Script does not need to be uploaded on a remote server and can be run locally.

Several authentication methods are supported (password, ssh key).

Commands can be run through several jump servers before reaching the remote server. No need to establish a session for each command, a single ssh session can run as many command as you want, including parallel queries, and you will get result for each command independently.

So, why another python library to setup remote server through ssh ? Here is a quick comparison with the most known existing python libraries
  • Paramiko: provide very good implementation of SSHv2 protocol in python but with a low level api a bit complex
  • Ansible: require more configuration and understanding to start. Moreover, support of bastion host is done with modification of local ssh config to use ProxyCommand, and this is needed for each bastion host.
  • Fabric: use of jump server is much easier than Ansible thanks to 'env.gateway' parameter, but does not allow jump through several servers.

Installation

To install JumpSSH, simply:

Examples

establish ssh session with a remote host through a gateway:

run commands on remote host:

remote rest api usage:

remote files operations:

Tests

jumpssh tests require docker, check docker documentation for how to install it depending on your OS. it also requires few python packages. To install them, run:

To run the test suite, clone the repository and run:

or simply:

Contributing

Bug Reports

Bug reports are hugely important! Before you raise one, though, please check through the GitHub issues, both open and closed, to confirm that the bug hasn't been reported before.

Feature Requests

If you think a feature is missing and could be useful in this module, feel free to raise a feature request through the GitHub issues

Code Contributions

When contributing code, please follow this project-agnostic contribution guide.

About

Python module to run commands on remote servers through one or more jump servers.

License:MIT License


Languages

Language:Python 95.9%Language:Shell 2.6%Language:Dockerfile 1.5%