Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work on Windows 10 #13

Open
alien2003 opened this issue Oct 23, 2019 · 4 comments
Open

Does not work on Windows 10 #13

alien2003 opened this issue Oct 23, 2019 · 4 comments

Comments

@alien2003
Copy link

alien2003 commented Oct 23, 2019

Installed with pip bundled with Python choco package

C:\Users\user>onlykey-agent -vvv -c [email protected]
Traceback (most recent call last):
  File "C:\Python38\Scripts\onlykey-agent-script.py", line 11, in <module>
    load_entry_point('onlykey-agent==0.0.4', 'console_scripts', 'onlykey-agent')()
  File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 2443, in load
    return self.resolve()
  File "c:\python38\lib\site-packages\pkg_resources\__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\python38\lib\site-packages\onlykey_agent\__main__.py", line 10, in <module>
    from . import client, formats, protocol, server
  File "c:\python38\lib\site-packages\onlykey_agent\client.py", line 49
    print 'identity', identity
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('identity', identity)?
@onlykey
Copy link

onlykey commented Oct 23, 2019

@alien2003 Yes, SSH works differently on Windows, up until recently Windows didn't even support SSH on command line at all and you had to use a tool like Putty. The agent should work if you use WSL - https://docs.microsoft.com/en-us/windows/wsl/install-win10

Edit - I just noticed the error also indicates you are using python 3 and the onlykey-agent is python 2.

@alien2003
Copy link
Author

alien2003 commented Oct 23, 2019

Windows has OpenSSH client and server now. I can just type ssh root@server in CMD and connect.
With Python 2.7

C:\Users\user>onlykey-agent -vvv -c [email protected]
2019-10-23 19:19:04,687 DEBUG        connected                                                                                            [client.py:160]
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\onlykey-agent.exe\__main__.py", line 7, in <module>
  File "c:\python27\lib\site-packages\onlykey_agent\__main__.py", line 123, in wrapper
    return func(*args, **kwargs)
  File "c:\python27\lib\site-packages\onlykey_agent\__main__.py", line 136, in run_agent
    with client_factory(curve=args.ecdsa_curve_name) as conn:
  File "c:\python27\lib\site-packages\onlykey_agent\client.py", line 33, in __enter__
    self.ok.read_string(timeout_ms=50)
  File "c:\python27\lib\site-packages\onlykey\client.py", line 355, in read_string
    return ''.join([chr(item) for item in self.read_bytes(MAX_INPUT_REPORT_SIZE, timeout_ms=timeout_ms) if item != 0])
  File "c:\python27\lib\site-packages\onlykey\client.py", line 344, in read_bytes
    out = self._hid.read(n, timeout_ms=timeout_ms)
  File "hid.pyx", line 105, in hid.device.read
ValueError: not open

Not a critical bug because I mostly use GNU/Linux, but would be great to implement native Windows support without WSL

@CargoCoder
Copy link

Hi, I am having exactly the same issue alien2003 has mentioned, even though I am using WSL. Tried on both Debian and Ubuntu 18.04 LTS "apps". Went through the installation, have setup the UDEV rule, on both cases I am getting the "ValueError: not open" error.

xxxx@xxxxx:~$ onlykey-agent -c [email protected] -vvv
2020-03-04 11:13:20,934 DEBUG        connected                                                                                            [client.py:160]
Traceback (most recent call last):
  File "/usr/local/bin/onlykey-agent", line 11, in <module>
    sys.exit(run_agent())
  File "/usr/local/lib/python2.7/dist-packages/onlykey_agent/__main__.py", line 123, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/onlykey_agent/__main__.py", line 136, in run_agent
    with client_factory(curve=args.ecdsa_curve_name) as conn:
  File "/usr/local/lib/python2.7/dist-packages/onlykey_agent/client.py", line 33, in __enter__
    self.ok.read_string(timeout_ms=50)
  File "/usr/local/lib/python2.7/dist-packages/onlykey/client.py", line 355, in read_string
    return ''.join([chr(item) for item in self.read_bytes(MAX_INPUT_REPORT_SIZE, timeout_ms=timeout_ms) if item != 0])
  File "/usr/local/lib/python2.7/dist-packages/onlykey/client.py", line 344, in read_bytes
    out = self._hid.read(n, timeout_ms=timeout_ms)
  File "hid.pyx", line 106, in hid.device.read
ValueError: not open

It should be noted this is the first time (and hopefully the last time) I am using WSL in my life. I might be doing something wrong - I've spent most of the morning trying to figure out what. This works well for me both on linux & mac. I am testing it on windows because I would like to introduce these into my company...

@onlykey
Copy link

onlykey commented Mar 4, 2020

@CargoCoder We have not tested this with WSL. I expect it will work as long as WSL allows the USB HID messages from host to WSL. I would try the following:

  1. In Win10 verify that the OnlyKey app works (USB HID communication with host OK)
  2. In WSL see that USB device shows up with $ lsusb (USB hardware connected)
  3. In WSL see that OnlyKey is connected using the OnlyKey CLI app here - https://docs.crp.to/command-line.html
  4. If that works the onlykey-agent should work, if not udev rule may be needed - https://docs.crp.to/linux.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants