user1424739
user1424739

Reputation: 13675

How to run paramiko demo_server.py?

https://raw.githubusercontent.com/paramiko/paramiko/master/demos/demo_server.py

I see the above demo_server of paramiko. But I don't see the instructions on how to run it. I run the following ./demo_server.py command. But once I run ssh [email protected] -p 2200, the server fails. Could anybody let me know the complete steps on how to run this example? Thanks.

$ python3 ./demo_server.py
Read key: 60733844cb5186657fdedaa22b5a57d5
Listening for connection ...
Got a connection!
*** Caught exception: <class 'ImportError'>: Unable to import a GSS-API / SSPI module!
Traceback (most recent call last):
  File "./demo_server.py", line 140, in <module>
    t = paramiko.Transport(client, gss_kex=DoGSSAPIKeyExchange)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/transport.py", line 445, in __init__
    self.kexgss_ctxt = GSSAuth("gssapi-keyex", gss_deleg_creds)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/paramiko/ssh_gss.py", line 107, in GSSAuth
    raise ImportError("Unable to import a GSS-API / SSPI module!")
ImportError: Unable to import a GSS-API / SSPI module!
$ ssh [email protected] -p 2200
kex_exchange_identification: read: Connection reset by peer

Upvotes: 0

Views: 369

Answers (1)

Herman
Herman

Reputation: 11

I managed to get it to work, make sure to go through these steps (Thank you Sandeep for the pip insight), chances are you may be missing the Kerberos dependencies:

  1. You may need to perform pip install gssapi in the CLI if that has not already been done (I'm using the Windows Command Prompt, Linux/WSL might need pip3 instead depending on your version of python)

  2. From there you will need to import the gssapi library into the code at the top with the other imported libraries, so just call import gssapi in demo_server.py

  3. After running demo_server.py again, the CLI should eventually say something like it is missing files located in Program Files\ MIT\ Kerberos\ bin, as Kerberos is a dependency for gssapi, you can install it from here:

    https://web.mit.edu/KERBEROS/dist/

Make sure you do custom install if you're not sure where it will be downloaded, so that you can set up the file location where the CLI says is missing in step 3 (Should automatically say Program Files\ MIT). I unchecked the boxes for auto-start and tickets, but not sure as to what your preferences may be. After all that, a computer restart is required.

Upvotes: 1

Related Questions