ixs / napalm-procurve

HP ProCurve Driver for NAPALM automation frontend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error reading SSH protocol banner

jamesb2147 opened this issue · comments

Using Netbox's built-in NAPALM capabilities to try to make features accessible via a web GUI. Anyway, when attempting to access a ProCurve switch via NAPALM, it returns this error:

{"detail":"Error connecting to the device at 10.0.254.182: Error reading SSH protocol banner"}

Cursory Googling reveals this is likely a somewhat generic error. A previous encounter with it lead to a finding that buffering wasn't being handled properly in paramiko, but that appears not to have resolved the issue for me (my paramiko version is 2.4.1, the latest release).

Anyway, just wondering if anyone else has encountered this. I'm running Netbox 2.3.3 on Python3.5 on Ubuntu 16.04 with Paramiko 2.4.1.

FWIW, I can use NAPALM to gather facts about IOS devices, hence my post here to the procurve driver first.

Any thoughts or evidence or pointers are much appreciated! Have a great day!

Could you add some paramiko debugging code to your script and see if you get some good output in the log?

import logging
logging.basicConfig(filename='test.log', level=logging.DEBUG)
logger = logging.getLogger("netmiko")

This should do the trick and generate a test.log file for you to investigate.

I want to start off by saying thank you for helping me, it's much appreciated.

What I got from the output is:

DEBUG:paramiko.transport:starting thread (client mode): 0xceb6d630
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.4.1
ERROR:paramiko.transport:Exception: Error reading SSH protocol banner
ERROR:paramiko.transport:Traceback (most recent call last):
ERROR:paramiko.transport:  File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 2044, in _check_banner
ERROR:paramiko.transport:    buf = self.packetizer.readline(timeout)
ERROR:paramiko.transport:  File "/usr/local/lib/python3.5/dist-packages/paramiko/packet.py", line 353, in readline
ERROR:paramiko.transport:    buf += self._read_timeout(timeout)
ERROR:paramiko.transport:  File "/usr/local/lib/python3.5/dist-packages/paramiko/packet.py", line 542, in _read_timeout
ERROR:paramiko.transport:    raise EOFError()
ERROR:paramiko.transport:EOFError
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 "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1893, in run
ERROR:paramiko.transport:    self._check_banner()
ERROR:paramiko.transport:  File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 2049, 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:

Github is showing 2.4.1 as the absolute latest release, so I'm not sure where this could be coming from. Worth noting I'm trying to run this with python3.5.

Also note that while paramiko is throwing an error generally tied to exceeding the 15s standard timeout waiting for a response from sshd, in this particular case, the error is thrown immediately. I have a prompt just before trying to open the connection and it's <1s between my hitting enter key and the error being thrown. No idea what could be causing that as of yet.

Figured it out. We have enabled IP restrictions on what ranges can manage the devices, so I was able to SSH from my laptop, but not from the server hosting my script. Added the server to the "authorized managers" list and all is well! Interesting that paramiko did not provide a more helpful error, but w/e, this was totally my idiocy. :)

Thanks again for your help, ixs!!!

@jamesb2147 Glad you could figure it out. And yes, connection problems are sometimes a bit difficult to parse based on the error message.