Closed fisherbe closed 5 months ago
This might be the same issue as #3424 which looks identical but is for Cisco IOS.
You can try the fix made in #3425 for the meantime.
You can try the fix made in #3425 for the meantime.
@FriendlyGecko
We have to use SSH, not sure if your telnet focused solution will help or not?
If you look through the code, the telnet function is fed into SSH functions. I only use SSH for networking, but since it inherits they inherit the telnet functions, I placed it there where it can benefit both. Fun fact: serial connections also inherit from telnet, so the name telnet is a little misleading.
@FriendlyGecko Your statement is not correct--telnet_login() is not used by SSH. It is shared for "serial" logins (as both telnet and serial have an interactive login). Your earlier problem was using "serial" which is why you saw that "telnet_login" code get called.
telnet_login is irrelevant/not used for any of the SSH code.
@fisherbe Can you show what your motd
looks like? You can obscure any company name or other company identifying information.
It has been a minute since I messed with the code for that merge request, but I don't believe that I changed anything except for the telnet code. I use that code now and it works for SSH connections for me.
@FriendlyGecko Just double checked Netmiko source code. telnet_login
is never used with SSH; it is only used for telnet and also for serial_login. Your original issue with stack trace was a failed serial
login.
@ktbyers Oh ok, I don't recall how I fixed it for SSH off the top of my head. So sorry I couldn't help more.
@FriendlyGecko No worries at all...I just didn't see how the telnet_login fix would help with an SSH issue.
I honestly probably just pasted that same code wherever the SSH authentication section is, but I don't have time to check/try it out right now. Something I can do in a couple weeks when I get back from vacation.
@FriendlyGecko SSH generally doesn't do an interactive authentication (so there is no equivalent code for SSH). There might be some special case exceptions for some platforms that do non-standard things for logging in.
@ktbyers ,
Default motd: "User Access Verification"
@ktbyers ,
If it perhaps helps, I know I mentioned above we have an empty password set for login. Also, no secret password set at all. But if we don't use .enable(), don't pass secret, and use a basic command not requiring enable, it still fails.
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Auth banner: b'User Access Verification\n'
INFO:paramiko.transport:Authentication (password) failed.
Maybe it's not the banner as the issue? Maybe it just doesn't correctly handle empty passwords? Or if no secret is set it somehow fails even though not using .enable()?
Not entirely sure, though I can log into the device via ssh manually just fine.
Yeah, it pretty clearly is failing authentication.
Can you show what it looks like when you manually SSH to the device? Just post the CLI interaction here?
@fisherbe Never mind...you posted it above:
$ ssh admin@<redacted>
User Access Verification
Password:
So you just hit
@fisherbe Never mind...you posted it above:
$ ssh admin@<redacted> User Access Verification Password:
So you just hit here and you login?
Yes, just hit enter there and you login with prompt of <hostname>#
There's some extra text that comes back from the switch after you authenticate and before you get the prompt. Just the basic info about the switch that every NXOS gives you afaik.
@ktbyers ,
I've confirmed that setting a password for the user makes the issue go away. Unfortunately we have some requirements to allow blank passwords in the environment since it's bare metal pre-deploy automation stuff. But it works for now. Hopefully the issue can be resolved. I will attempt to figure it out also here and there as I have time.
@fisherbe Issue is (probably) this:
@fisherbe Issue is (probably) this:
@ktbyers
So what I'm reading this as is netmiko doesn't support no password methods directly, you have to use paramiko on your own essentially, etc?
@fisherbe You could probably make a custom driver and add support in. If you look at HP ProCurve you can see the code pattern for supporting the noauth.
See here:
https://github.com/ktbyers/netmiko/blob/develop/netmiko/hp/hp_procurve.py#L189-L190
So you would basically create a new driver and a new class, the class would inherit from the standard Cisco NXOS class and then have that _build_ssh_client()
code. You would also probably need a special session_preparation
at least to send a null password and to verify you were logged in (once again you can look at that HP ProCurve driver as a reference).
The issue basically boils down to that no-password is its own special case to Paramiko and Netmiko doesn't have easy ways to switch over to this (especially in cases where it is an atypical pattern for given platform).
@ktbyers thanks for the responses!
Description of Issue/Question
We are attempting to authenticate to a Cisco NXOS device (among others). Our Arista connections are working (default passwords set) but the Cisco comes to us with no password set. We tried null string '' which does not work. We tried None. We tried with and without secret and with and without using .enable() and running a command that doesn't require enable. Everything fails on the authentication side though. We initially thought the issue was netmiko being unable to handle a no/null/empty password situation, but now I'm wondering if it's a motd banner issue I need to customize a check for somehow. But, it's a pretty basic default motd banner so I would be surprised if that was the issue.
The bottom few lines from netmiko log we generated:
Connecting manually:
Seems it never makes it past 'User Access Verification' which is a default NXOS motd banner AFAIK.
Setup
Netmiko version
Netmiko device_type (if relevant to the issue)
Steps to Reproduce the Issue
Error Traceback
Relevant Python code
Test code used:
I probably don't need secret / .enable() here for 'show version' but will need it for some other stuff in the future. Just testing.