bordaigorl / rmview

A live viewer for reMarkable written in PyQt5
GNU General Public License v3.0
755 stars 63 forks source link

rmview asks for ssh passphrase despite the public key on remarkable and active ssh-agent #31

Closed Kratacoa closed 3 years ago

Kratacoa commented 3 years ago

As per title; the passphrase is the one used to access identity of my laptop device, not the one used to connect to Remarkable. rmview.json is pretty much unmodified, and I don't have any particular notes from the build of dependencies.
I am able to authenticate succesfully, without passphrase query, via just ssh.
I have a rM1, and software is updated to the latest release (2.5.0.27).

bordaigorl commented 3 years ago

Ah I see what might be happening. Would you be able to try something for me?

bordaigorl commented 3 years ago

@Kratacoa thanks for reporting, I think I was using Paramiko in a way that was not fully exploiting its features. I'll push a new version soon, it would be great if you could test it.

Kratacoa commented 3 years ago

If by new version you meant the last commits, I am afraid I am getting the same message :/
My configuration is example.json.
Should I try out the steps mentioned in the first reply?

bordaigorl commented 3 years ago

Yes, try the last commits but:

This should make sure the connection settings are determined entirely by the system-wide SSH configuration

Kratacoa commented 3 years ago

When I remove key, it asks me for my reMarkable's password instead.
You said system-wide: so far I have used the user configuration file. Isn't that supported?

bordaigorl commented 3 years ago

That is the old behaviour. Are you sure you are running the version at 0fa4234fdce4d4f1f6eea4514b6f548683cd971a ? If you installed rmview with pip install . you may need to install again after pulling the changes. Also: which OS are you on? (Btw thanks for testing this!)

Kratacoa commented 3 years ago

If you installed rmview with pip install . you may need to install again after pulling the changes.

This did the trick. Thank you for the assistance, and in general for your project :)

Also: which OS are you on?

Void Linux, musl version.

bordaigorl commented 3 years ago

Great! I'm closing and including in next release. Thanks for the feedback!

pheraph commented 3 years ago

I installed the current version (the default vnc branch) on macOS and everything works, but I still see the problem that if I try to authenticate via SSH key I am asked for my keyphrase. My .ssh/config is

Host remarkableUSB
        HostName 10.11.99.1
        User root

And I can login just fine via ssh remarkableUSB, but the following configuration doesn't work without a password prompt:

{
    "ssh": {
        "address": [
            "10.11.99.1"
        ]
    }
}

And this one keeps asking for my keyphrase:

{
    "ssh": {
        "address": [
            "10.11.99.1"
        ],
        "key" : "~/.ssh/id_rsa"
    }
}

Should this work or am I maybe on the wrong branch?

bordaigorl commented 3 years ago

@pheraph in principle it should work, provided the ssh-agent is running in the background and that you added to it the relevant key (which should be true if ssh does not ask you for the passphrase during login). (By keyphrase I assume you mean the passphrase used to encrypt the id_rsa key) You could try running rmview after running ssh-add -K ~/.ssh/id_rsa and see if it works.

You could also try using:

{
    "ssh": {
        "address": [
            "10.11.99.1"
        ],
        "auth_method": "key",
        "key" : "~/.ssh/id_rsa"
    }
}

(you can omit the key setting if you include in your ssh config IdentityFile ~/.ssh/id_rsa in the relevant Host). If this still asks you for your passphrase then it means that Paramiko is not able to get the passphrase from your ssh-agent... (As a workaround you could use, just for the tablet, a new key without passphrase.)

Finally, the devel branch has some changes to the authentication code, you could try to see if that helps.

pheraph commented 3 years ago

@bordaigorl Thanks for your detailed reply! I tried your suggestions without success though. Your assumption is right I don't have to enter my passphrase during login. Still I am asked for address and passphrase even with your provided config. I also switched to the devel branch, but was not able to launch rmview successfully:

Qt Concurrent has caught an exception thrown from a worker thread. This is not supported, exceptions thrown in worker threads must be caught before control returns to Qt Concurrent.
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
libc++abi.dylib: terminating with uncaught exception of type NSException

But this is obviously out of the scope of this issue. I now helped myself by stepping away from the SSH authentication and adding the plain password to the config file (with chmod 600 on the file). This is as good for me as an unprotected SSH key.