ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.58k stars 1.3k forks source link

If you set password complexity on the aruba procurve switch, you cannot connect to ssh. #2941

Open py-noob-01 opened 2 years ago

py-noob-01 commented 2 years ago

Among aruba procurve switches, switches with password configuration-control settings experience errors when accessing the sshConnectHandler. If you clear the command to access it, the ConnectHandler will function normally. The general ssh approach is normally accessible with or without config. However, you must set the command for security authentication screening. Is there a way to debug the problem?

https://community.arubanetworks.com/blogs/esupport1/2020/09/30/password-control-configuration-pvos

from netmiko import ConnectHandler

l2 = {
        'device_type': 'aruba_procurve',
        'ip': devices,
        'username': 'admin',
        'password': 'qwe123!@#',
        'secret': 'qwe123!@#',
        }

net_connect = ConnectHandler(**l2)
net_connect.enable()
config_backup = open(devices.strip(), 'w')

for l2_commands in l2_command.list:
    print(config_backup.write('\n!Command: ' + l2_commands.strip() + '\n'))
    output = net_connect.send_command(l2_commands)
    print(config_backup.write(output))

config_backup.close()
net_connect.disconnect()

image

ktbyers commented 2 years ago

@py-noob-01 Are you sure your password is still valid to the device? Have you tried to manually SSH using your credentials?

Can you show me what the manual SSH login looks like from the CLI (after this is enabled)?

py-noob-01 commented 2 years ago

@ktbyers Of course. I tested it several times and there was no problem with the ssh connection test from my PC to the appropriate equipment. If "netmikossh" had a "password configuration-control" setting, an error occurred, and if there was no setting, it worked according to the script I wrote. This setting is for the complexity of the equipment account password