-
Notifications
You must be signed in to change notification settings - Fork 136
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
SSH2 login failed #160
Comments
EDIT I'm getting better results when I bypass the multi-auth loop by changing line 283 of ssh2.py to call on auth_password intead of auth_none. This seems like it'll be a sufficient workaround for my current use-case, cisco ZTP.
I'm wondering if IOS-XE 16.3.x doesn't like the rapid subsequent connections spawned by the I am having the same issue with IOS-XE version 16.3.6. SCRIPT
I can execute the script fine once, but if I do it again shortly after, I get the following;
But from the switch I can see the SSH session establish, here is a log from a successful pass, and then a fail; Switch log from first run, SUCCESS
Switch log from subsequent run, FAIL
I created a new script to get debug output, logs from switch are identical as they were from the original script; Debug Script
First pass, Success
Second pass, FAIL
|
This is may no longer apply with the latest version in master, since we essentially disabled the authentication hack. Could you please test again? Another potential fix is being discussed in pull request #173. |
The problem now is, that the generic driver has not enabled the hack enymore. There are some IOS devices which need the hack, but they are recognized as IOS after successful authentication:
After enabling the hack for the generic driver, everything works:
Now I don't know what should be the default behaviour, but it still has to be worked out. |
@bigmars86 the issue that you are describing is unrelated to this bug. It's tracked in issue #166. I'll follow up there. |
I resorted to the same change and now login to all our routers work again. Maybe a bit of a background, our current setup is using exscript 2.4.8 and python 2.7. We have a variety of network equipment, from Alcatel (now Nokia) SAS-M/T, Arista, Cisco IOS and XR, Juniper and the odd Ocnos an Cumulus devices. I'm currently looking at moving our scripts to python 3.6 and exscript 2.6 (using the new FreeBSD package for it). Our old setup basically just set
and worked everywhere. I see there are talks about making the login method settable, that would be great, if it will be a way to fix this problem. |
@JohnHay , thanks for your suggestion, we are taking 6000 backups per day from different kind of equipment (Cisco, OneAccess, Ciena, ..) and this always worked but after moving to a new redhat server with exscript 2.6.3 python 3.8 we had a few hundred devices with the exact same issue (fail on the auth_none() procedure). Debugging SSH and trying different options did not help in finding a solution .. It's actually a very strange problem because we have for example 2 identical hardware devices with identical software and configuration and on 1 router the backup will always work and on the other one it will always fail. After patching the exscript ssh2.py file like you suggested all backups are now working again !! |
import Exscript
from Exscript.protocols import SSH2,Account
device = SSH2(debug=9)
acc = Account("xxxx","xxxxx")
device.connect("HOST1",port=9090)
print device.response
print device.get_remote_version()
print device.get_banner()
print device.is_dummy()
device.login(acc)
print device.response
'''''''''''''''''''' output 👍
generic: Rejecting ssh-rsa host key for HOST1: 5cf53be5446cb97a4941aad09e3b29a8
None
SSH-2.0-OpenSSH_4.3
None
False
generic: Attempting to authenticate xxxx
generic: auth_none failed, supported: [u'publickey', u'password']
generic: Rejecting ssh-rsa host key for HOST1: 5cf53be5446cb97a4941aad09e3b29a8
generic: Authenticating with _paramiko_auth_agent
generic: Authentication with _paramiko_auth_agent failed: auth agent found no keys
generic: Rejecting ssh-rsa host key for HOST1: 5cf53be5446cb97a4941aad09e3b29a8
generic: Authenticating with _paramiko_auth_autokey
generic: Authentication with _paramiko_auth_autokey failed: Failed to authenticate with given username and password/key
generic: Rejecting ssh-rsa host key for HOST1: 5cf53be5446cb97a4941aad09e3b29a8
generic: Authenticating with _paramiko_auth_password
generic: Attempting to app-authenticate tarek.anis.
generic: waiting for: ['[\r\n][^\\r\\n]*(?:bad secrets|denied|invalid|too short|incorrect|connection timed out|failed|failure)', '(user ?name|user|login): $', u'(?:s\/Key|otp-md5) (\d+) (\S+)(?=\s|[\r\n])', 'password:? $', '[\r\n](?:[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\!\\"\\#\\$\\%\\&\\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~\\ \\\t\\\n\\\r\\\x0b\\\x0c]*|[\\x1b\\x07\\x00]*)[\\[\\<]?\\w+(?:(?:(?:[\\w+\\-]+)\\@)?(?:[\\w+\\-\\.]+))?:?(?:(?:(?:(?:[\\w\\+\\-\\._]+))?(?:/(?:[\\w\\+\\-\\._]+))*/?)|~(?:(?:(?:[\\w\\+\\-\\._]+))?(?:/(?:[\\w\\+\\-\\._]+))*/?)?)?[: ]?(?:(?:(?:(?:[\\w\\+\\-\\._]+))?(?:/(?:[\\w\\+\\-\\._]+))*/?)|~(?:(?:(?:[\\w\\+\\-\\._]+))?(?:/(?:[\\w\\+\\-\\._]+))*/?)?)?(?:\\((?:[\\w\\+\\-\\._]+)\\))?[\\]\\-]?[#>%\\$\\]] ?[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\!\\"\\#\\$\\%\\&\\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~\\ \\\t\\\n\\\r\\\x0b\\\x0c]\Z']
generic: Expecting a prompt
generic: Expected pattern: ["'[\\r\\n][^\\\\r\\\\n](?:bad secrets|denied|invalid|too short|incorrect|connection timed out|failed|failure)'", "'(user ?name|user|login): *$'", "u'(?:s\\/Key|otp-md5) (\\d+) (\\S+)(?=\\s|[\\r\\n])'", "'password:? $'", ''[\\r\\n](?:[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\\\!\\\\"\\\\#\\\\$\\\\%\\\\&\\\\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\-\\\\.\\\\/\\\\:\\\\;\\\\<\\\\=\\\\>\\\\?\\\\@\\\\[\\\\\\\\\\\\]\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~\\\\ \\\\\\t\\\\\\n\\\\\\r\\\\\\x0b\\\\\\x0c]*|[\\\\x1b\\\\x07\\\\x00]*)[\\\\[\\\\<]?\\\\w+(?:(?:(?:[\\\\w+\\\\-]+)\\\\@)?(?:[\\\\w+\\\\-\\\\.]+))?:?(?:(?:(?:(?:[\\\\w\\\\+\\\\-\\\\._]+))?(?:/(?:[\\\\w\\\\+\\\\-\\\\._]+))*/?)|~(?:(?:(?:[\\\\w\\\\+\\\\-\\\\._]+))?(?:/(?:[\\\\w\\\\+\\\\-\\\\._]+))*/?)?)?[: ]?(?:(?:(?:(?:[\\\\w\\\\+\\\\-\\\\._]+))?(?:/(?:[\\\\w\\\\+\\\\-\\\\._]+))*/?)|~(?:(?:(?:[\\\\w\\\\+\\\\-\\\\._]+))?(?:/(?:[\\\\w\\\\+\\\\-\\\\._]+))*/?)?)?(?:\\\\((?:[\\\\w\\\\+\\\\-\\\\._]+)\\\\))?[\\\\]\\\\-]?[#>%\\\\$\\\\]] ?[^0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\\\!\\\\"\\\\#\\\\$\\\\%\\\\&\\\\\\\'\\\\(\\\\)\\\\*\\\\+\\\\,\\\\-\\\\.\\\\/\\\\:\\\\;\\\\<\\\\=\\\\>\\\\?\\\\@\\\\[\\\\\\\\\\\\]\\\\^\\\\_\\\\`\\\\{\\\\|\\\\}\\\\~\\\\ \\\\\\t\\\\\\n\\\\\\r\\\\\\x0b\\\\\\x0c]\\Z'']
ericsson_ban: Protocol: driver replaced: generic -> ericsson_ban
ericsson_ban: Protocol.app_authenticate(): driver replaced
ericsson_ban: waiting for: ['Login failed', 'user:', u'(?:s\/Key|otp-md5) (\d+) (\S+)(?=\s|[\r\n])', 'pass:', '[\r\n][\-\w+\.]+(?:\([^\\)]+\))?[%#] ?$|(?:\(y/n\)\[n\])']
ericsson_ban: Expecting a prompt
ericsson_ban: Expected pattern: ["'Login failed'", "'user:'", "u'(?:s\\/Key|otp-md5) (\\d+) (\\S+)(?=\\s|[\\r\\n])'", "'pass:'", "'[\\r\\n][\\-\\w+\\.]+(?:\\([^\\\\)]+\\))?[%#] ?$|(?:\\(y/n\\)\\[n\\])'"]
Traceback (most recent call last):
File "C:/Python27/ssh test.py", line 11, in
device.authenticate(acc)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 699, in authenticate
self.app_authenticate(app_account, flush=flush)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 868, in app_authenticate
self._app_authenticate(account, password, flush, bailout)
File "C:\Python27\lib\site-packages\Exscript\protocols\protocol.py", line 772, in _app_authenticate
raise TimeoutException(msg)
TimeoutException: Buffer: u''
'''''''''''''''' please is there are any solution for it
The text was updated successfully, but these errors were encountered: