Paramiko SSH Session -> Authentification failed

Sockets, TCP/IP, (XML-)RPC und ähnliche Themen gehören in dieses Forum
Antworten
werwurm01
User
Beiträge: 2
Registriert: Sonntag 28. Februar 2021, 17:17

Hallo
bin neu in diesem Forum und beschäftige mich auch gerade neu mit Python.
Für die Arbeit versuche den SSH Zugriff auf zugekaufte Ethernet NT's von ADVA um die Konfiguration zu automatisieren. Die SSH Session muss zwingend per User/Password erfolgen. Ein SSH-Key -Login lassen die Geräte nicht zu.
Als SSH Client möchte ich Paramiko nutzen.

Code: Alles auswählen

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, port, username, password)

if ssh.get_transport() is not None:
    print("Verbunden")
else:
    print("Keine Verbindung")
Als Fehler bekomme ich immer:

Code: Alles auswählen

paramiko.ssh_exception.AuthenticationException: Authentication failed.
Der User und das Passwort sind definitiv richtig.
Her das Debugfile von Paramiko:

Code: Alles auswählen

DEB [20210228-17:56:23.861] thr=1   paramiko.transport: starting thread (client mode): 0xd0beb2e0
DEB [20210228-17:56:23.861] thr=1   paramiko.transport: Local version/idstring: SSH-2.0-paramiko_2.7.2
DEB [20210228-17:56:23.881] thr=1   paramiko.transport: Remote version/idstring: SSH-2.0-OpenSSH_7.4
INF [20210228-17:56:23.881] thr=1   paramiko.transport: Connected (version 2.0, client OpenSSH_7.4)
DEB [20210228-17:56:23.884] thr=1   paramiko.transport: kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['ssh-rsa', 'rsa-sha2-512', 'rsa-sha2-256'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: Kex agreed: curve25519-sha256@libssh.org
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: HostKey agreed: ssh-rsa
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: Cipher agreed: aes128-ctr
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: MAC agreed: hmac-sha2-256
DEB [20210228-17:56:23.885] thr=1   paramiko.transport: Compression agreed: none
DEB [20210228-17:56:23.970] thr=1   paramiko.transport: kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEB [20210228-17:56:23.971] thr=1   paramiko.transport: Switch to new keys ...
DEB [20210228-17:56:23.973] thr=2   paramiko.transport: Adding ssh-rsa host key for 192.168.0.200: b'f2aa0b52eaf68face2c79cd56ffe880e'
DEB [20210228-17:56:23.976] thr=1   paramiko.transport: userauth is OK
INF [20210228-17:56:23.986] thr=1   paramiko.transport: Authentication (password) failed.
DEB [20210228-17:56:23.996] thr=1   paramiko.transport: EOF in transport thread
Habe das Ganze mal mit PuTTY und commandline Aufruf probiert. Hier wird das Password nicht übernommen und muss noch "manuell" eingetragen werden.
Ich befürchte das Gerät hat eine "spezielle" SSH Implementierung :(


Wäre das bei Paramiko oder einem anderen SSH Client möglich bei einer "inaktiven" Verbindung User und Password zu übergeben?

Hat da jemand eine Idee??

Besten Dank und viele Grüße,
Marcus
AlexL
User
Beiträge: 16
Registriert: Donnerstag 5. August 2021, 10:38

Code: Alles auswählen

   # Create an instance
   ssh = paramiko.SSHClient()
   # Load system HostKeys key
   ssh.load_system_host_keys()
   # Automatically add a policy
   ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
   #Connect to remote host
   ssh.connect('192.168.27.116',port=22, username='volumio',
   password='volumio')
Der Code funktioniert bei mir.
Antworten