paramiko 重新键入导致 EOFError()

paramiko rekeying causes EOFError()

重新加密后,_read_all receives string of len(0) 并关闭连接。我能做些什么来解决这个问题。请在下面找到调试日志和堆栈跟踪。

DEB [20211007-15:13:46.331] thr=2   paramiko.transport.sftp: [chan 0] open(b'v1_full_25127.zip', 'rb') -> 31
[2021-10-07 15:13:46,331] {sftp.py:158} DEBUG - [chan 0] open(b'v1_full_25127.zip', 'rb') -> 31
DEB [20211007-15:34:48.572] thr=1   paramiko.transport: Rekeying (hit 32846 packets, 536876792 bytes received)
[2021-10-07 15:34:48,572] {packet.py:588} DEBUG - Rekeying (hit 32846 packets, 536876792 bytes received)
DEB [20211007-15:34:48.992] thr=1   paramiko.transport: kex algos:['diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group-exchange-sha256'] server key:['ssh-rsa'] client encrypt:['aes128-cbc', 'aes192-cbc', 'aes256-cbc', '3des-cbc', 'blowfish-cbc', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', 'aes192-cbc', 'aes256-cbc', '3des-cbc', 'blowfish-cbc', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96', 'hmac-sha256', 'hmac-sha256@ssh.com'] server mac:['hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96', 'hmac-sha256', 'hmac-sha256@ssh.com'] client compress:['none', 'zlib'] server compress:['none', 'zlib'] client lang:[''] server lang:[''] kex follows?False
[2021-10-07 15:34:48,992] {transport.py:1819} DEBUG - kex algos:['diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group-exchange-sha256'] server key:['ssh-rsa'] client encrypt:['aes128-cbc', 'aes192-cbc', 'aes256-cbc', '3des-cbc', 'blowfish-cbc', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] server encrypt:['aes128-cbc', 'aes192-cbc', 'aes256-cbc', '3des-cbc', 'blowfish-cbc', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr'] client mac:['hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96', 'hmac-sha256', 'hmac-sha256@ssh.com'] server mac:['hmac-sha1', 'hmac-md5', 'hmac-sha1-96', 'hmac-md5-96', 'hmac-sha256', 'hmac-sha256@ssh.com'] client compress:['none', 'zlib'] server compress:['none', 'zlib'] client lang:[''] server lang:[''] kex follows?False
DEB [20211007-15:34:48.992] thr=1   paramiko.transport: Kex agreed: diffie-hellman-group-exchange-sha256
[2021-10-07 15:34:48,992] {transport.py:1819} DEBUG - Kex agreed: diffie-hellman-group-exchange-sha256
DEB [20211007-15:34:48.992] thr=1   paramiko.transport: HostKey agreed: ssh-rsa
[2021-10-07 15:34:48,992] {transport.py:1819} DEBUG - HostKey agreed: ssh-rsa
DEB [20211007-15:34:48.992] thr=1   paramiko.transport: Cipher agreed: aes128-ctr
[2021-10-07 15:34:48,992] {transport.py:1819} DEBUG - Cipher agreed: aes128-ctr
DEB [20211007-15:34:48.993] thr=1   paramiko.transport: MAC agreed: hmac-sha1
[2021-10-07 15:34:48,993] {transport.py:1819} DEBUG - MAC agreed: hmac-sha1
DEB [20211007-15:34:48.993] thr=1   paramiko.transport: Compression agreed: none
[2021-10-07 15:34:48,993] {transport.py:1819} DEBUG - Compression agreed: none
DEB [20211007-15:34:49.256] thr=1   paramiko.transport: Got server p (2048 bits)
[2021-10-07 15:34:49,256] {transport.py:1819} DEBUG - Got server p (2048 bits)
DEB [20211007-15:34:49.567] thr=1   paramiko.transport: Switch to new keys ...
[2021-10-07 15:34:49,567] {transport.py:1819} DEBUG - Switch to new keys ...
DEB [20211007-15:42:46.628] thr=1   paramiko.transport: [chan 0] EOF sent (0)
[2021-10-07 15:42:46,628] {channel.py:1212} DEBUG - [chan 0] EOF sent (0)
DEB [20211007-15:42:46.629] thr=2   paramiko.transport.sftp: [chan 0] close(31)
[2021-10-07 15:42:46,629] {sftp.py:158} DEBUG - [chan 0] close(31)

Traceback (most recent call last):
  File "/home/python3.8/site-packages/paramiko/sftp_client.py", line 843, in _read_response
    t, data = self._read_packet()
  File "/home/python3.8/site-packages/paramiko/sftp.py", line 201, in _read_packet
    x = self._read_all(4)
  File "/home/python3.8/site-packages/paramiko/sftp.py", line 188, in _read_all
    raise EOFError()
EOFError

问题记录在 Paramiko 公开问题 https://github.com/paramiko/paramiko/issues/151