remouseable icon indicating copy to clipboard operation
remouseable copied to clipboard

SSH key authentication for Windows

Open OysteinAmundsen opened this issue 3 years ago • 1 comments

This message comes from both the released pre-built binary, and from my own attempt at building the solution. I'm on a windows box, using an rsa key which I have placed in authorized_keys on the device. Connecting to the remarkable using ssh works fine.

main --ssh-ip="10.11.99.1"
panic: dial unix /tmp/ssh-cicSZVtNN2OJ/agent.1270: connect: A socket operation encountered a dead network.

goroutine 1 [running]:
main.main()
        C:/Users/oyste/Downloads/remouseable/main.go:71 +0x1fc5

What can I do to solve this?

OysteinAmundsen avatar Mar 10 '21 21:03 OysteinAmundsen

SSH key based authentication does not work on Windows right now but I think it's possible to fix this. Currently, if you do not give the app your tablet root password then it will attempt to connect over SSH using the local ssh-agent. The windows ssh-agent, though, doesn't listen on unix domain sockets like it does on OSX and linux because windows doesn't support them. That's why it fails to connect even though you have an ssh-agent running. The windows version is using a windows specific named pipe. There's an open issue for this on the windows ssh-agent github page.

It looks like there is a way to use an SSH key directly, though: https://pkg.go.dev/golang.org/x/crypto/ssh#example-PublicKeys. A new CLI flag like --ssh-key="path/to/key" could be added. When detected, the new flag could trigger a swap of the SSH configuration away from the ssh-agent and onto directly using the keys. For reference, here is where the current SSH configuration setup is done in the app: https://github.com/kevinconway/remouseable/blob/master/main.go#L61.

If you're able to make a PR to add the new CLI flag and SSH config setup then I'm happy to help review and test it. If not then I will eventually make the changes myself but I'm not sure when. In the meantime, if you want to connect the tablet but don't want your root password in the terminal history then you can use --ssh-password="-" and it will prompt you for password in a way that isn't recorded.

kevinconway avatar Mar 10 '21 23:03 kevinconway