rmview
rmview copied to clipboard
feat: support non-RSA ssh keys (Ed25519Key, ECDSAKey...)
Adds support for non-RSA keys to authenticate to the reMarkable (Ed25519Key, ECDSAKey, DSSKey).
First loads the key and checks the type, then returns the relevant paramiko PKey object.
Fixes the cryptic error that happened when loading a non-RSA key:
[INFO] STARTING: Wed Jun 5 10:02:52 2024
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[INFO] Searching configuration in rmview.json, /root/.config/rmview.json
[INFO] Fetching configuration from /root/.config/rmview.json
[WARNING] Config file "/root/.config/rmview.json" is readable by others (permissions=644). If your config file contains secrets (e.g. password) you are strongly encouraged to make sure it's not readable by other users (chmod 600 /root/.config/rmview.json)
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: Version 4 or later of flush extension not found
libGL error: failed to load driver: i915
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/paramiko/pkey.py", line 698, in _uint32_cstruct_unpack
s_size = struct.unpack(">L", data[idx : idx + 4])[0]
struct.error: unpack requires a buffer of 4 bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/rmview", line 8, in <module>
sys.exit(rmViewMain())
File "/usr/local/lib/python3.9/site-packages/rmview/rmview.py", line 601, in rmViewMain
app = rMViewApp(sys.argv)
File "/usr/local/lib/python3.9/site-packages/rmview/rmview.py", line 186, in __init__
self.requestConnect()
File "/usr/local/lib/python3.9/site-packages/rmview/rmview.py", line 289, in requestConnect
rMConnect(**args,
File "/usr/local/lib/python3.9/site-packages/rmview/connection.py", line 88, in __init__
self.pkey = paramiko.RSAKey.from_private_key_file(key)
File "/usr/local/lib/python3.9/site-packages/paramiko/pkey.py", line 421, in from_private_key_file
key = cls(filename=filename, password=password)
File "/usr/local/lib/python3.9/site-packages/paramiko/rsakey.py", line 64, in __init__
self._from_private_key_file(filename, password)
File "/usr/local/lib/python3.9/site-packages/paramiko/rsakey.py", line 197, in _from_private_key_file
self._decode_key(data)
File "/usr/local/lib/python3.9/site-packages/paramiko/rsakey.py", line 213, in _decode_key
n, e, d, iqmp, p, q = self._uint32_cstruct_unpack(data, "iiiiii")
File "/usr/local/lib/python3.9/site-packages/paramiko/pkey.py", line 718, in _uint32_cstruct_unpack
raise SSHException(str(e))
paramiko.ssh_exception.SSHException: unpack requires a buffer of 4 bytes