reStream icon indicating copy to clipboard operation
reStream copied to clipboard

Use a persistent SSH connection

Open captn3m0 opened this issue 4 years ago • 3 comments

Currently, the reStream shell script calls ssh 6-7 times.

I ssh to the Remarkable using my Yubikey with a touch policy configured. The policy requires me to touch the Yubikey for every invocation of SSH (the handshake ie). That means a rmview session is more painful to setup than it needs to be.

I found some solutions here: https://serverfault.com/questions/216125/how-can-i-create-persistent-ssh-connection-to-stream-commands-over-a-period-of and https://unix.stackexchange.com/questions/552723/store-a-remote-ssh-session/553028#553028

If any of them feel good enough, I can file a PR.

captn3m0 avatar Nov 23 '21 17:11 captn3m0

You may want to create a dedicated SSH key just for your reMarkable instead. Moreover, the methods you suggested doesn't allow to redirect the output from ssh. EDIT: The FIFO file may work if the stream can actually be written there.

1dotd4 avatar Nov 25 '21 09:11 1dotd4

Having to touch your Yubikey seven times before being able to use this script can indeed be very frustrating. So I will gladly help you with finding a fix for that situation.

However, changing reStream to use a single SSH connection will be complex, because sometimes we parse the result of an ssh command, and sometimes we pipe the result to another file. As an extra complexity, the last command will output a binary stream which can be annoying to handle in the shell.

I think there are other solutions which will also fix your problem, without needing to complicate the current script further.

  • The ControlMaster method mentioned in your first SO question may be able to solve your problem as well. If that is set-up you only need to execute ssh -MNf remarkable before running this script. The connections made by reStream should re-use that connection.
  • The suggestion of @1dotd4 is even simpler. I don't know your situation, but having a Yubikey to access the reMarkable (through an USB connection) seems a bit overkill here. I also have a separate key, just for the reMarkable, which even does not have a ssh password on it I think.

Please let me know which solution works best. I'll add some documentation to the README for others with the same problem.

rien avatar Nov 25 '21 11:11 rien

I'd tried the ssh -MNf flow, but had added it to the script instead of running it separately. Will try it again and report back 👍🏽

The key works over WiFi as well, so I'd like to keep using my Yubikey if possible.

captn3m0 avatar Nov 25 '21 11:11 captn3m0