{"id":19502233,"url":"https://github.com/amadeusitgroup/jumpssh","last_synced_at":"2025-05-16T15:07:03.777Z","repository":{"id":21256717,"uuid":"92018147","full_name":"AmadeusITGroup/JumpSSH","owner":"AmadeusITGroup","description":"Python module to run commands on remote servers through one or more jump servers.","archived":false,"fork":false,"pushed_at":"2024-12-01T14:45:24.000Z","size":177,"stargazers_count":84,"open_issues_count":53,"forks_count":30,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-16T15:06:54.615Z","etag":null,"topics":["bastion-host","jumpbox","jumpserver","proxycommand","python","ssh"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AmadeusITGroup.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-22T06:18:16.000Z","updated_at":"2025-02-27T07:38:46.000Z","dependencies_parsed_at":"2024-01-28T01:48:50.127Z","dependency_job_id":"939d96f4-77b6-4f99-9725-0b15400097de","html_url":"https://github.com/AmadeusITGroup/JumpSSH","commit_stats":{"total_commits":124,"total_committers":4,"mean_commits":31.0,"dds":"0.44354838709677424","last_synced_commit":"51ca8ee726a0ac9aad4887f438c6f1ca7a178211"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmadeusITGroup%2FJumpSSH","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmadeusITGroup%2FJumpSSH/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmadeusITGroup%2FJumpSSH/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmadeusITGroup%2FJumpSSH/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AmadeusITGroup","download_url":"https://codeload.github.com/AmadeusITGroup/JumpSSH/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553959,"owners_count":22090417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bastion-host","jumpbox","jumpserver","proxycommand","python","ssh"],"created_at":"2024-11-10T22:15:39.202Z","updated_at":"2025-05-16T15:07:03.757Z","avatar_url":"https://github.com/AmadeusITGroup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=======\nJumpSSH\n=======\n\n.. image:: https://secure.travis-ci.org/AmadeusITGroup/JumpSSH.svg?branch=master\n    :target: http://travis-ci.org/AmadeusITGroup/JumpSSH\n\n.. image:: https://coveralls.io/repos/AmadeusITGroup/JumpSSH/badge.svg?branch=master\n    :target: https://coveralls.io/r/AmadeusITGroup/JumpSSH?branch=master\n\n.. image:: https://badge.fury.io/py/jumpssh.svg\n    :target: https://badge.fury.io/py/jumpssh\n\n.. image:: https://readthedocs.org/projects/jumpssh/badge?version=latest\n    :target: https://jumpssh.readthedocs.io?badge=latest\n\n.. image:: https://sonarcloud.io/api/project_badges/measure?project=amadeusitgroup_jumpssh\u0026metric=bugs\n    :target: https://sonarcloud.io/dashboard?id=amadeusitgroup_jumpssh\n\n.. image:: https://sonarcloud.io/api/project_badges/measure?project=amadeusitgroup_jumpssh\u0026metric=vulnerabilities\n    :target: https://sonarcloud.io/dashboard?id=amadeusitgroup_jumpssh\n\n\n:JumpSSH:          Python module to run commands on remote servers\n:Copyright:        Copyright (c) 2017 Amadeus sas\n:License:          `MIT \u003chttps://github.com/AmadeusITGroup/JumpSSH/blob/master/LICENSE\u003e`_\n:Documentation:    https://jumpssh.readthedocs.io\n:Development:      https://github.com/AmadeusITGroup/JumpSSH\n\nWhat\n----\n`JumpSSH` is a module for Python 2.7+/3.5+ that can be used to run commands on remote servers through a gateway.\n\nIt is based on `paramiko library \u003chttp://www.paramiko.org\u003e`_.\nIt provides the ability to execute commands on hosts that are not directly accessible but only through one or\nmore servers.\nScript does not need to be uploaded on a remote server and can be run locally.\n\nSeveral authentication methods are supported (password, ssh key).\n\nCommands can be run through several jump servers before reaching the remote server.\nNo need to establish a session for each command, a single ssh session can run as many command as you want,\nincluding parallel queries, and you will get result for each command independently.\n\nSo, why another python library to setup remote server through ssh ? Here is a quick comparison with the most known existing python libraries\n - Paramiko: provide very good implementation of SSHv2 protocol in python but with a low level api a bit complex\n - Ansible: require more configuration and understanding to start.\n   Moreover, support of bastion host is done with modification of local ssh config to use ProxyCommand, and this is\n   needed for each bastion host.\n - Fabric: use of jump server is much easier than Ansible thanks to 'env.gateway' parameter, but does not allow jump through several servers.\n\nInstallation\n------------\nTo install JumpSSH, simply:\n\n.. code:: bash\n\n    $ pip install jumpssh\n\n\nExamples\n--------\nestablish ssh session with a remote host through a gateway:\n\n.. code:: python\n\n    \u003e\u003e\u003e from jumpssh import SSHSession\n\n    # establish ssh connection between your local machine and the jump server\n    \u003e\u003e\u003e gateway_session = SSHSession('gateway.example.com',\n    ...                              'my_user', password='my_password').open()\n\n    # from jump server, establish connection with a remote server\n    \u003e\u003e\u003e remote_session = gateway_session.get_remote_session('remote.example.com',\n    ...                                                     password='my_password2')\n\n\nrun commands on remote host:\n\n.. code:: python\n\n    # command will be executed remotely and output will be returned locally and printed\n    \u003e\u003e\u003e print(remote_session.get_cmd_output('ls -lta'))\n    total 28\n    drwxr-xr-x. 412 root    root    12288 Mar 21 14:25 ..\n    drwx------.   2 my_user my_user    28 Mar  6 19:25 .ssh\n    drwx------.   3 my_user my_user    70 Mar  6 19:25 .\n    -rw-r--r--.   1 my_user my_user    18 Jul 12  2016 .bash_logout\n    -rw-r--r--.   1 my_user my_user   193 Jul 12  2016 .bash_profile\n    -rw-r--r--.   1 my_user my_user   231 Jul 12  2016 .bashrc\n\n    # get exit code of the remotely executed command (here to check if a package is installed)\n    \u003e\u003e\u003e remote_session.get_exit_code('yum list installed package_name')\n    0\n\nremote rest api usage:\n\n.. code:: python\n\n    # calling rest api on remote host that is only accessible from the gateway\n    \u003e\u003e\u003e from jumpssh import RestSshClient\n    \u003e\u003e\u003e rest_client = RestSshClient(gateway_session)\n\n    # syntax is similar to requests library (http://docs.python-requests.org)\n    \u003e\u003e\u003e http_response = rest_client.get('http://remote.example.com/helloworld')\n    \u003e\u003e\u003e http_response.status_code\n    200\n    \u003e\u003e\u003e http_response.text\n    u'Hello, World!'\n\nremote files operations:\n\n.. code:: python\n\n    # check if remote path exists\n    \u003e\u003e\u003e remote_session.exists('/path/to/a/file')\n    True\n\n    # copy file from local machine to remote host through gateway\n    \u003e\u003e\u003e remote_session.put('/local/path/to/a/file', '/remote/path/to/the/file')\n\n    # create file on remote host from local content\n    \u003e\u003e\u003e remote_session.file('/remote/path/to/the/file',\n    ...                     content='remote file content', permissions='600')\n\n    # download remote file on local machine from remote host through gateway\n    \u003e\u003e\u003e remote_session.get('/remote/path/to/the/file', '/local/path/')\n\n\nTests\n-----\njumpssh tests require docker, check `docker documentation \u003chttps://docs.docker.com\u003e`_ for how to install it\ndepending on your OS.\nit also requires few python packages. To install them, run:\n\n.. code:: bash\n\n    $ pip install -r requirements_dev.txt\n\nTo run the test suite, clone the repository and run:\n\n.. code:: bash\n\n    $ pytest -sv tests/\n\nor simply:\n\n.. code:: bash\n\n    $ tox\n\n\nContributing\n------------\n\nBug Reports\n^^^^^^^^^^^\nBug reports are hugely important! Before you raise one, though,\nplease check through the `GitHub issues \u003chttps://github.com/AmadeusITGroup/JumpSSH/issues\u003e`_,\nboth open and closed, to confirm that the bug hasn't been reported before.\n\nFeature Requests\n^^^^^^^^^^^^^^^^\nIf you think a feature is missing and could be useful in this module, feel free to raise a feature request through the\n`GitHub issues \u003chttps://github.com/AmadeusITGroup/JumpSSH/issues\u003e`_\n\nCode Contributions\n^^^^^^^^^^^^^^^^^^\nWhen contributing code, please follow `this project-agnostic contribution guide \u003chttp://contribution-guide.org/\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famadeusitgroup%2Fjumpssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famadeusitgroup%2Fjumpssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famadeusitgroup%2Fjumpssh/lists"}