[paramiko] Problem connect to cisco asa devices

2010-03-13 Thread Florian Koch
hi @all,

I try to connect to a cisco asa, but I always get an 
paramiko.AuthenticationException.

Here is the code: (I have replaced the IP,User,Passwd with xxx in the code and 
tracebak)


#!/usr/bin/env python 

import paramiko 

ssh = paramiko.SSHClient() 

ssh.load_system_host_keys() 

ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 

ssh.connect('xxx', 22, username='xxx', password='xxx') 

stdin, stdout, stderr = ssh.exec_command(show version) 

data = stdout.read.splitlines() 

for line in data: 
print line 


Here the Tracebak:

python test.py 
Traceback (most recent call last): 
File test.py, line 14, in module 
 ssh.connect('xxx', 22, username='xxx', password='xxx') 
File /usr/lib/python2.6/site-packages/paramiko/client.py, line 327, 
in connect 
 self._auth(username, password, pkey, key_filenames, allow_agent, 
look_for_keys) 
File /usr/lib/python2.6/site-packages/paramiko/client.py, line 481, 
in _auth 
 raise saved_exception 
paramiko.AuthenticationException: Authentication failed.


If I try to connect via linux console and openssh with the same IP, Password 
and user, the connection works without problems.

Can anyone help?___
paramiko mailing list
paramiko@lag.net
http://www.lag.net/cgi-bin/mailman/listinfo/paramiko

Re: [paramiko] Problem connect to cisco asa devices

2010-03-14 Thread Florian Koch

Am 14.03.2010 um 20:33 schrieb César García:

 Hello I've just tested your code en it works for me, the only line
 that I changed was:
 this:
 data = stdout.read.splitlines()
 
 for this:
 
 data = stdout.readlines()


I try this, but the result is the same as before..do you connect to cisco asa?


 Obviously you are changing the xs for the real IP,user,password, right 

yes
 
 --
 http://celord.blogspot.com/


I have enabled logging, so I can give mor informations (the xxx are 
replacements from me...)

DEB [20100314-21:22:54.567] thr=1   paramiko.transport: starting thread (client 
mode): 0x2469390L
INF [20100314-21:22:54.570] thr=1   paramiko.transport: Connected (version 2.0, 
client Cisco-1.25)
DEB [20100314-21:22:54.817] thr=1   paramiko.transport: kex 
algos:['diffie-hellman-group1-sha1'] server key:['ssh-rsa'] client 
encrypt:['aes128-cbc', '3des-cbc', 'aes192-cbc', 'aes256-cbc'] server 
encrypt:['aes128-cbc', '3des-cbc', 'aes192-cbc', 'aes256-cbc'] client 
mac:['hmac-sha1', 'hmac-sha1-96', 'hmac-md5', 'hmac-md5-96'] server 
mac:['hmac-sha1', 'hmac-sha1-96', 'hmac-md5', 'hmac-md5-96'] client 
compress:['none'] server compress:['none'] client lang:[''] server lang:[''] 
kex follows?False
DEB [20100314-21:22:54.818] thr=1   paramiko.transport: Ciphers agreed: 
local=aes128-cbc, remote=aes128-cbc
DEB [20100314-21:22:54.818] thr=1   paramiko.transport: using kex 
diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-cbc, 
remote aes128-cbc; mac: local hmac-sha1, remote hmac-sha1; compression: local 
none, remote none
DEB [20100314-21:22:54.930] thr=1   paramiko.transport: Switch to new keys ...
DEB [20100314-21:22:54.945] thr=2   paramiko.transport: Adding ssh-rsa host key 
for xxx: xxx
DEB [20100314-21:22:54.946] thr=2   paramiko.transport: Trying SSH agent key xxx
DEB [20100314-21:22:54.949] thr=1   paramiko.transport: userauth is OK
DEB [20100314-21:22:54.966] thr=1   paramiko.transport: Authentication type 
(publickey) not permitted.
DEB [20100314-21:22:54.967] thr=1   paramiko.transport: Allowed methods: 
['password']
INF [20100314-21:22:54.986] thr=1   paramiko.transport: Disconnect (code 2): 
Protocol error: expected packet type 50, got 5



___
paramiko mailing list
paramiko@lag.net
http://www.lag.net/cgi-bin/mailman/listinfo/paramiko