[GH-ISSUE #18] SSH backend broken ? #9

Closed
opened 2026-02-27 15:45:57 +03:00 by kerem · 1 comment
Owner

Originally created by @Josue-T on GitHub (May 15, 2020).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/18

Originally assigned to: @jhollowe on GitHub.

Hello,

Trying to use the this library I wasn't able to use it with SSH backup (openssh and ssh_paramiko). With HTTP it work.

This is my log:

Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from proxmoxer import ProxmoxAPI
>>> proxmox = ProxmoxAPI('localhost', user='root', backend='ssh_paramiko')
2020-05-15 17:57:06,109 DEBUG:paramiko.transport: starting thread (client mode): 0xeb21de80
2020-05-15 17:57:06,117 DEBUG:paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.7.1
2020-05-15 17:57:06,117 DEBUG:paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2
2020-05-15 17:57:06,118 INFO:paramiko.transport: Connected (version 2.0, client OpenSSH_7.9p1)
2020-05-15 17:57:06,120 DEBUG:paramiko.transport: kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
2020-05-15 17:57:06,120 DEBUG:paramiko.transport: Kex agreed: curve25519-sha256@libssh.org
2020-05-15 17:57:06,121 DEBUG:paramiko.transport: HostKey agreed: ssh-ed25519
2020-05-15 17:57:06,121 DEBUG:paramiko.transport: Cipher agreed: aes128-ctr
2020-05-15 17:57:06,121 DEBUG:paramiko.transport: MAC agreed: hmac-sha2-256
2020-05-15 17:57:06,121 DEBUG:paramiko.transport: Compression agreed: none
2020-05-15 17:57:06,129 DEBUG:paramiko.transport: kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
2020-05-15 17:57:06,129 DEBUG:paramiko.transport: Switch to new keys ...
2020-05-15 17:57:06,130 DEBUG:paramiko.transport: Adding ssh-ed25519 host key for localhost: b'f55d10f823755bf3a72735031f8b383e'
2020-05-15 17:57:06,132 DEBUG:paramiko.transport: Trying discovered key b'f1112b5151b104a18ed3abe4f7556e0d' in /root/.ssh/id_rsa
2020-05-15 17:57:06,133 DEBUG:paramiko.transport: userauth is OK
2020-05-15 17:57:06,149 INFO:paramiko.transport: Authentication (publickey) successful!
>>> 2020-05-15 17:57:06,179 DEBUG:paramiko.transport: Received global request "hostkeys-00@openssh.com"
2020-05-15 17:57:06,180 DEBUG:paramiko.transport: Rejecting "hostkeys-00@openssh.com" global request from server.
2020-05-15 17:57:06,184 DEBUG:paramiko.transport: Debug msg: b'/root/.ssh/authorized_keys:3: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding'

>>> proxmox.version.get()
2020-05-15 17:57:18,697 INFO:proxmoxer.core: GET /version
2020-05-15 17:57:18,697 DEBUG:paramiko.transport: [chan 0] Max packet in: 32768 bytes
2020-05-15 17:57:18,698 DEBUG:paramiko.transport: [chan 0] Max packet out: 32768 bytes
2020-05-15 17:57:18,698 DEBUG:paramiko.transport: Secsh channel 0 opened.
2020-05-15 17:57:18,700 DEBUG:paramiko.transport: [chan 0] Sesch channel 0 request ok
2020-05-15 17:57:19,820 DEBUG:paramiko.transport: [chan 0] EOF received (0)
2020-05-15 17:57:19,821 DEBUG:proxmoxer.core: Status code: 500, output: {"keyboard":"fr-ch","release":"6.2","repoid":"9824574a","version":"6.2-4"}

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/venv/lib/python3.7/site-packages/proxmoxer/core.py", line 106, in get
    return self(args)._request("GET", params=params)
  File "/tmp/venv/lib/python3.7/site-packages/proxmoxer/core.py", line 101, in _request
    resp.content))
proxmoxer.core.ResourceException: 500 Internal Server Error: {"keyboard":"fr-ch","release":"6.2","repoid":"9824574a","version":"6.2-4"}

>>> 2020-05-15 17:57:19,825 DEBUG:paramiko.transport: [chan 0] EOF sent (0)

Trying to understand where is the issue I saw these lines:

github.com/proxmoxer/proxmoxer@60662c4891/proxmoxer/backends/base_ssh.py (L46-L51)

As I understand we should get by stderr an error code. But In my case the stderr variable is completely empty so we don't get the value.

Note that I'm on proxmox 6.2, maybe there was some change in the API.

Originally created by @Josue-T on GitHub (May 15, 2020). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/18 Originally assigned to: @jhollowe on GitHub. Hello, Trying to use the this library I wasn't able to use it with SSH backup (openssh and ssh_paramiko). With HTTP it work. This is my log: ``` Python 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from proxmoxer import ProxmoxAPI >>> proxmox = ProxmoxAPI('localhost', user='root', backend='ssh_paramiko') 2020-05-15 17:57:06,109 DEBUG:paramiko.transport: starting thread (client mode): 0xeb21de80 2020-05-15 17:57:06,117 DEBUG:paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.7.1 2020-05-15 17:57:06,117 DEBUG:paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_7.9p1 Debian-10+deb10u2 2020-05-15 17:57:06,118 INFO:paramiko.transport: Connected (version 2.0, client OpenSSH_7.9p1) 2020-05-15 17:57:06,120 DEBUG:paramiko.transport: kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False 2020-05-15 17:57:06,120 DEBUG:paramiko.transport: Kex agreed: curve25519-sha256@libssh.org 2020-05-15 17:57:06,121 DEBUG:paramiko.transport: HostKey agreed: ssh-ed25519 2020-05-15 17:57:06,121 DEBUG:paramiko.transport: Cipher agreed: aes128-ctr 2020-05-15 17:57:06,121 DEBUG:paramiko.transport: MAC agreed: hmac-sha2-256 2020-05-15 17:57:06,121 DEBUG:paramiko.transport: Compression agreed: none 2020-05-15 17:57:06,129 DEBUG:paramiko.transport: kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256> 2020-05-15 17:57:06,129 DEBUG:paramiko.transport: Switch to new keys ... 2020-05-15 17:57:06,130 DEBUG:paramiko.transport: Adding ssh-ed25519 host key for localhost: b'f55d10f823755bf3a72735031f8b383e' 2020-05-15 17:57:06,132 DEBUG:paramiko.transport: Trying discovered key b'f1112b5151b104a18ed3abe4f7556e0d' in /root/.ssh/id_rsa 2020-05-15 17:57:06,133 DEBUG:paramiko.transport: userauth is OK 2020-05-15 17:57:06,149 INFO:paramiko.transport: Authentication (publickey) successful! >>> 2020-05-15 17:57:06,179 DEBUG:paramiko.transport: Received global request "hostkeys-00@openssh.com" 2020-05-15 17:57:06,180 DEBUG:paramiko.transport: Rejecting "hostkeys-00@openssh.com" global request from server. 2020-05-15 17:57:06,184 DEBUG:paramiko.transport: Debug msg: b'/root/.ssh/authorized_keys:3: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding' >>> proxmox.version.get() 2020-05-15 17:57:18,697 INFO:proxmoxer.core: GET /version 2020-05-15 17:57:18,697 DEBUG:paramiko.transport: [chan 0] Max packet in: 32768 bytes 2020-05-15 17:57:18,698 DEBUG:paramiko.transport: [chan 0] Max packet out: 32768 bytes 2020-05-15 17:57:18,698 DEBUG:paramiko.transport: Secsh channel 0 opened. 2020-05-15 17:57:18,700 DEBUG:paramiko.transport: [chan 0] Sesch channel 0 request ok 2020-05-15 17:57:19,820 DEBUG:paramiko.transport: [chan 0] EOF received (0) 2020-05-15 17:57:19,821 DEBUG:proxmoxer.core: Status code: 500, output: {"keyboard":"fr-ch","release":"6.2","repoid":"9824574a","version":"6.2-4"} Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/tmp/venv/lib/python3.7/site-packages/proxmoxer/core.py", line 106, in get return self(args)._request("GET", params=params) File "/tmp/venv/lib/python3.7/site-packages/proxmoxer/core.py", line 101, in _request resp.content)) proxmoxer.core.ResourceException: 500 Internal Server Error: {"keyboard":"fr-ch","release":"6.2","repoid":"9824574a","version":"6.2-4"} >>> 2020-05-15 17:57:19,825 DEBUG:paramiko.transport: [chan 0] EOF sent (0) ``` Trying to understand where is the issue I saw these lines: https://github.com/proxmoxer/proxmoxer/blob/60662c4891859ca1b6cf87d7068958d4f9dc7f21/proxmoxer/backends/base_ssh.py#L46-L51 As I understand we should get by stderr an error code. But In my case the `stderr` variable is completely empty so we don't get the value. Note that I'm on proxmox 6.2, maybe there was some change in the API.
Author
Owner

@Josue-T commented on GitHub (May 19, 2020):

Thanks a lot for the quick fix.

<!-- gh-comment-id:631054143 --> @Josue-T commented on GitHub (May 19, 2020): Thanks a lot for the quick fix.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#9
No description provided.