Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxycommand fix #681

Closed
wants to merge 3 commits into from
Closed

Proxycommand fix #681

wants to merge 3 commits into from

Conversation

@radssh
Copy link
Contributor

@radssh radssh commented Feb 7, 2016

Simple fix of using unbuffered subprocess.PIPE uncovered a trickier bug
where the lack of timeout on initial readline call would pull data from
the first real packet, throwing off subsequent reads.

Doesn’t seem necessary to preserve a read buffer across recv() calls,
especially if it isn’t implemented correctly.

radssh added 3 commits Aug 21, 2015
Simple fix of using unbuffered subprocess.PIPE uncovered a trickier bug
where the lack of timeout on initial readline call would pull data from
the first real packet, throwing off subsequent reads.

Doesn’t seem necessary to preserve a read buffer across recv() calls,
especially if it isn’t implemented correctly.
@rsuciu-gsg
Copy link

@rsuciu-gsg rsuciu-gsg commented Jul 7, 2016

Are there any updates on this?
I have also the same issue when running Python 3 (although it works fine in 2.7).

Thanks.

@ledil
Copy link

@ledil ledil commented Jul 18, 2016

any news ? Ive got the same problem ...

@nvgoldin
Copy link

@nvgoldin nvgoldin commented Jul 18, 2016

same here.
any news?

@nvgoldin
Copy link

@nvgoldin nvgoldin commented Jul 18, 2016

Confirming this patch fixed the issue, however I have another issue now, not sure if its related:

  File ".../python3.5/site-packages/paramiko/transport.py", line 1550, in stop_thread
    and not self.sock._closed and not self.packetizer.closed
AttributeError: 'ProxyCommand' object has no attribute '_closed'

I think this was added recently to transport.py in: 0ebd247

            while (
                self.is_alive() and self is not threading.current_thread()
                and not self.sock._closed and not self.packetizer.closed
            ):
                self.join(0.1)
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Jul 20, 2016

@nvgoldin that secondary issue is #774, FYI.

I haven't had time to test this fix myself; if @ledil and @rsuciu-gsg can confirm @nvgoldin's assert that it fixes the issue for them, I may consider merging w/o self-testing. Thanks!

@catmeme
Copy link

@catmeme catmeme commented Jul 20, 2016

Verifying this PR resolved this issue for me as well. Thanks @radssh

@rsuciu-gsg
Copy link

@rsuciu-gsg rsuciu-gsg commented Jul 21, 2016

Also works for me.

Thanks,
Ramona

On Wed, Jul 20, 2016 at 10:01 PM, catmeme notifications@github.com wrote:

Verifying this PR resolved this issue for me as well. Thanks @radssh
https://github.com/radssh


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#681 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANb3XK5DaDNDaWdl-zHkhckRSQjeVYaTks5qXnB8gaJpZM4HVNHN
.

@bitprophet bitprophet added this to the 1.16.3 et al milestone Jul 21, 2016
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Jul 26, 2016

Thanks all. Merging on faith. Read the fix commit & commit message and squinted at the code real good...pretty sure I see why it's a good fix. Computers: difficult.

@miguelozu21
Copy link

@miguelozu21 miguelozu21 commented Oct 17, 2017

hi, i have a related issue. can you help me?

DEBUG:paramiko.transport:starting thread (client mode): 0x291fcd0L
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.3.1
ERROR:paramiko.transport:Exception: Error reading SSH protocol banner
ERROR:paramiko.transport:Traceback (most recent call last):
ERROR:paramiko.transport: File "/usr/lib/python2.7/site-packages/paramiko/transport.py", line 1854, in run
ERROR:paramiko.transport: self._check_banner()
ERROR:paramiko.transport: File "/usr/lib/python2.7/site-packages/paramiko/transport.py", line 2005, in _check_banner
ERROR:paramiko.transport: 'Error reading SSH protocol banner' + str(e)
ERROR:paramiko.transport:SSHException: Error reading SSH protocol banner
ERROR:paramiko.transport:
Traceback (most recent call last):
File "xxxx.py", line 19, in
ssh.connect(hostname = name, port = port ,username = user, sock=proxy, password=None,key_filename = key_file, banner_timeout=None, timeout = 60)
File "/usr/lib/python2.7/site-packages/paramiko/client.py", line 385, in connect
t.start_client(timeout=timeout)
File "/usr/lib/python2.7/site-packages/paramiko/transport.py", line 543, in start_client
raise e
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner

@yang-dev
Copy link

@yang-dev yang-dev commented Mar 19, 2018

Trying to netconf on tcp/22 through ProxyCommand, still running into this issue with paramiko 2.4.1 (already have c638ecf), Python 3.6.4.

ERROR:ncclient.transport.ssh:Exception: Error reading SSH protocol banner due to _read_timeout()

@cndcourt
Copy link

@cndcourt cndcourt commented Mar 27, 2018

Hi - I have encountered this with python 2.7.10. Is there a workaround or fix? Sorry - but reading this trail I couldn't see a clear step to take to get this working. Here is what I'm trying to do.

The setup is a pure key setup - not using user/password. I can do the proxy manually
with ssh.
Thanks for any help. /best Don

proxy='130.35.42.7'
proxy_command = 'ssh -q -W %h:%p {}'.format(proxy)
proxy = paramiko.ProxyCommand(proxy_command)

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, sock=proxy)

stdin, stdout, stderr = client.exec_command('uname -a')

@Tahasadiki
Copy link

@Tahasadiki Tahasadiki commented Dec 30, 2019

@cndcourt did you find a solution/workaround to this ?

@nachiketdhamankar
Copy link

@nachiketdhamankar nachiketdhamankar commented Feb 26, 2020

I am having the same issue with python 3.6.1 and paramiko 2.7.1 (latest from pipenv). Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet