SFTP with ProxyCommand throwing Error reading SSH protocol banner
Open
Nobody has claimed this yet.
Needs investigation
SFTP
Support
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi all
trying to run the following and i cant seem to get it working
Its accessing an sftp server behind a bastion
using Version: 2.10.3
>>> with paramiko.proxy.ProxyCommand(f'sshpass -p {SBC_PASSWORD} ssh -o "ProxyJump 10.10.10.1" admin@20.20.20.1') as pc:
... with paramiko.client.SSHClient() as client:
... client.connect('100.71.133.13', sock=pc, banner_timeout=60)
... sftp = client.open_sftp()
... o = sftp.listdir()
... print(o.readline())
...
DEBUG:paramiko.transport:starting thread (client mode): 0xe45bed0
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.10.3
DEBUG:paramiko.transport:Banner: vtc-us-east-...f87cf77-esbc# SSH-2.0-paramiko_2.10.3
DEBUG:paramiko.transport:Banner: % command not found
DEBUG:paramiko.transport:Banner: vtc-us-east-...f87cf77-esbc#
ERROR:paramiko.transport:Exception (client): Error reading SSH protocol banner
ERROR:paramiko.transport:Traceback (most recent call last):
ERROR:paramiko.transport: File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2270, in _check_banner
ERROR:paramiko.transport: buf = self.packetizer.readline(timeout)
ERROR:paramiko.transport: File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/packet.py", line 380, in readline
ERROR:paramiko.transport: buf += self._read_timeout(timeout)
ERROR:paramiko.transport: File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/packet.py", line 622, in _read_timeout
ERROR:paramiko.transport: raise socket.timeout()
ERROR:paramiko.transport:socket.timeout
ERROR:paramiko.transport:
ERROR:paramiko.transport:During handling of the above exception, another exception occurred:
ERROR:paramiko.transport:
ERROR:paramiko.transport:Traceback (most recent call last):
ERROR:paramiko.transport: File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2093, in run
ERROR:paramiko.transport: self._check_banner()
ERROR:paramiko.transport: File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2275, in _check_banner
ERROR:paramiko.transport: "Error reading SSH protocol banner" + str(e)
ERROR:paramiko.transport:paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
ERROR:paramiko.transport:
Traceback (most recent call last):
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2270, in _check_banner
buf = self.packetizer.readline(timeout)
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/packet.py", line 380, in readline
buf += self._read_timeout(timeout)
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/packet.py", line 622, in _read_timeout
raise socket.timeout()
socket.timeout
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/client.py", line 406, in connect
t.start_client(timeout=timeout)
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 698, in start_client
raise e
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2093, in run
self._check_banner()
File "/home/<redacted>/.local/lib/python3.7/site-packages/paramiko/transport.py", line 2275, in _check_banner
"Error reading SSH protocol banner" + str(e)
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with paramiko.proxy.ProxyCommand and SSHClient.connect, then inspect the logged Transport._check_banner and Packetizer.readline paths. Reproduce the reported ProxyJump setup with Paramiko 2.10.3; the issue is only complete once the cause of the banner timeout is established and an appropriate regression test or documented resolution is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100