05-31-2020 03:59 PM - edited 05-31-2020 04:04 PM
Does anyone know if python jumpssh library works when the jumpbox is a windows? If you have a working implementation of jumpssh over a windows server jumpbox, I would love to hear your feedbacks and sharing. Do I have to install openssh on the windows jumpbox to make it work? If you have suggestions for other solutions, I would love to hear.
From its documentation, it seems it would only work with a linux jumpbox.
https://pypi.org/project/jumpssh/
Thanks.
Solved! Go to Solution.
06-04-2020 04:54 AM - edited 06-04-2020 04:55 AM
Hi @pn2020
I had a little play with jump_ssh .. thought might come handy at some point .. btw .. thanks for sharing :)
I used Windows 10 as jumpbox .. installed OpenSSH server - https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
Simple to code I used to run show ver on remote host.
#!/usr/bin/env python from jumpssh import SSHSession from getpass import getpass jumpbox = '172.16.100.13' rhost = 'sbx-iosxr-mgmt.cisco.com' juser = input("Jumpbox username: ") jpass = getpass("Jumpbox password: ") try: jump_session = SSHSession(jumpbox, username=juser, password=jpass).open() if jump_session.is_active() == True: print() print("Connected to jumpbox ... {}".format(jumpbox)) try: remote_session = jump_session.get_remote_session(rhost, username='admin', port=8181, password='C1sco12345', look_for_keys=False, allow_agent=False,) if remote_session.is_active(): print() print("Connected to remote host ... {}\n".format(rhost)) result = remote_session.run_cmd('sh ver') print(result.output) except Exception as ex: print() print("Unable to connect to the remote host ... {}".format(rhost)) print(ex) print() jump_session.close() print() print("Jumpbox connection closed.") print() except Exception as ex: print() print("Unable to connect to the jumpbox ... {}".format(jumpbox)) print(ex) print()
05-31-2020 07:20 PM
Which part of it is broken? SSH to the jump host itself or after that?
Are you able to SSH to the Windows jump host manually? (Like a putty or from terminal?)
05-31-2020 10:01 PM
Unfortunately, I can't. I got @ssh_exchange_identification: read: Connection reset by peer, after being hung for a while.
Looking like, I have to talk to the server system admin to see if openssh can be installed on the windows jumpbox.
05-31-2020 10:41 PM
Actually, ssh from a local cmd widows to the windows jumpbox works. But doesn't look like ssh is installed on the windows jumpbox, ie, ssh cli command isn't recognized.
06-01-2020 06:45 AM
Hi
You do need to install OpenSSH server on Windows Jumpbox -
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
06-01-2020 01:28 PM
Thanks everyone for your feedbacks. I will look more into this.
06-04-2020 04:54 AM - edited 06-04-2020 04:55 AM
Hi @pn2020
I had a little play with jump_ssh .. thought might come handy at some point .. btw .. thanks for sharing :)
I used Windows 10 as jumpbox .. installed OpenSSH server - https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
Simple to code I used to run show ver on remote host.
#!/usr/bin/env python from jumpssh import SSHSession from getpass import getpass jumpbox = '172.16.100.13' rhost = 'sbx-iosxr-mgmt.cisco.com' juser = input("Jumpbox username: ") jpass = getpass("Jumpbox password: ") try: jump_session = SSHSession(jumpbox, username=juser, password=jpass).open() if jump_session.is_active() == True: print() print("Connected to jumpbox ... {}".format(jumpbox)) try: remote_session = jump_session.get_remote_session(rhost, username='admin', port=8181, password='C1sco12345', look_for_keys=False, allow_agent=False,) if remote_session.is_active(): print() print("Connected to remote host ... {}\n".format(rhost)) result = remote_session.run_cmd('sh ver') print(result.output) except Exception as ex: print() print("Unable to connect to the remote host ... {}".format(rhost)) print(ex) print() jump_session.close() print() print("Jumpbox connection closed.") print() except Exception as ex: print() print("Unable to connect to the jumpbox ... {}".format(jumpbox)) print(ex) print()
06-04-2020 05:21 AM
Wow, that's awesome, thanks omz for sharing! I will play more with jumpssh.
03-16-2021 11:50 PM - edited 03-16-2021 11:57 PM
@omz, thanks for sharing ! Solved my problem which uses RHEL linux distro as the jumphost.
I should add, in my case I needed to modify the jump.session sub-method port number from 8181 to 22.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide