0

I am trying to create a script that will run commands over my 1000 Cisco devices. The device model is: Cisco Sx220 Series Switch Software, Version 1.1.4.1

The issue is that there is some kind of strange behavior for some of those Cisco devices.

When I am trying to login with regular SSH (PUTTY) with the correct credentials we are first getting 'Authentication Failure' and after 1 seconds I am getting the User Password Prompt again, typing the same credentials again is giving me a successful login.

The problem is that when I am trying to connect using my script (uses ParallelSSHClient), the connection drops after getting the authentication failure message and not able to enter the credentials again since it is getting the exception and terminal the program.

I am looking for a way to enter those credentials manual by connecting to the machine, getting the Authentication Failure message and ignoring it, recognizing that the current prompt has the User or Password appears on screen and then send it manually. I look for this kind of procedure anywhere but without any luck. Does ParallelSSHClient has this feature? If Paramiko has it, I am willing to move to Paramiko. Thanks :)

try:
        client = ParallelSSHClient(hosts=ip_list, user=user, password=password)

except Exception as err:
        print("There was an issue with connecting to the machine")

command_output = client.run_command(command)

Here is the accrual error that I am getting:

pssh.exceptions.AuthenticationException: ('Authentication error while connecting to %s:%s - %s', '172.31.255.10', 22, AuthenticationException('Password authentication failed',))
Yaniv
  • 79
  • 7
  • Show us PuTTY 0.72 screenshot of the authentication. – Martin Prikryl Aug 07 '19 at 08:54
  • I have found a way to perform this. The netmiko module can communicate with those Cisco devices better than Paramiko. – Yaniv Aug 11 '19 at 14:36
  • Netmiko uses Paramiko internally. You cannot do anything with Netmiko, what is not possible with Paramiko alone. – Martin Prikryl Aug 17 '19 at 14:57
  • Thanks for your assistance. I have found a way to perform this with success. I used pexpect that is actually using the local OpenSSH in the Linux server in order to expect the string of the login failure and then when the authentication screen is being shown again I am entering the credentials again. It also helped me to overcome issues with paramiko that is alerting that some of the switches does not support ssh v2. Since OpenSSH connected successfully to those old switches, pexpect resolved all my issues :) – Yaniv Aug 23 '19 at 17:35

0 Answers0