rajneeshaec / ncclient

Automatically exported from code.google.com/p/ncclient
Apache License 2.0
0 stars 1 forks source link

cannot run nc01.py example #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run nc01.py with a host.
2.
3.

Hi,

I am trying to run nc01.py test script against my netconf agent host and I
am getting these errors. The known_hosts file is in ~/.ssh directory and
the key is in there. I can connect via ssh manually.

File "./nc01.py", line 21, in <module>
    demo(sys.argv[1], os.getenv("USER"))
  File "./nc01.py", line 16, in demo
    with manager.connect(host=host, port=830, username=user) as m:
  File "/usr/lib/python2.6/site-packages/ncclient/manager.py", line 116, in
connect_ssh
    session.connect(*args, **kwds)
  File "/usr/lib/python2.6/site-packages/ncclient/transport/ssh.py", line
215, in connect
    raise SSHUnknownHostError(host, fingerprint)
ncclient.transport.errors.SSHUnknownHostError: Unknown host key
[72:4b:f0:3e:60:6f:18:f0:4b:e0:07:6a:5e:f5:b0:f8] for [175.85.234.100]

Could you please help me troubleshoot this.

many thanks

-- Rade

Original issue reported on code.google.com by rad...@gmail.com on 10 Nov 2009 at 7:18

GoogleCodeExporter commented 8 years ago
The comments in nc01.py clearly says they "assume that the user calling the 
script is
known by the server and that suitable SSH keys are in place.". With this in 
mind you
have two options:
 1. Add suitable SSH keys (see SSH documentation)
 2. Provide your own default_unknown_host_cb implementation (see the Transport /
Session layer part of the documentation about how to do that)

Hope this helps.

Original comment by callemob...@gmail.com on 4 Apr 2010 at 8:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I hit the same issue while running nc01.py..

my setup is very simple 

    netconf client(debian based system) -----------------netconf server(a router which has netconf capability) 

1.I have generated an ssh key  on the client  and copied on to  the server 
3.. when I directly ssh to the server . it just goes through with out asking 
the password.
4. when  I run the script I see below error .

Any help could be appreciated.

 <snip>

  with manager.connect(host=host, port=830, username=user) as m:
  File "/usr/local/lib/python2.7/dist-packages/ncclient-0.4.1-py2.7.egg/ncclient/manager.py", line 143, in connect
    return connect_ssh(*args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/ncclient-0.4.1-py2.7.egg/ncclient/manager.py", line 116, in connect_ssh
    session.connect(*args, **kwds)
  File "/usr/local/lib/python2.7/dist-packages/ncclient-0.4.1-py2.7.egg/ncclient/transport/ssh.py", line 206, in connect
    raise SSHUnknownHostError(host, fingerprint)
ncclient.transport.errors.SSHUnknownHostError: Unknown host key 
[91:9a:04:72:ff:9a:a4:47:50:f2:93:4a:0c:55:a2:b0] for [10.18.180.162]
<s/nip>

Original comment by venkates...@gmail.com on 17 Sep 2014 at 10:18

GoogleCodeExporter commented 8 years ago
ok..the simple solution would be to return TRUE from default_unknown_host_cb 
since I don't have any specific implementation.

thanks
-Venky

Original comment by venkates...@gmail.com on 19 Sep 2014 at 11:13

GoogleCodeExporter commented 8 years ago

But why is the "Unknown host key" fingerprint different from the actual server 
key fingerprint as shown by "ssh -v" and ssh-keygen -l -F ?

Original comment by michel.c...@gmail.com on 10 Oct 2014 at 12:36

GoogleCodeExporter commented 8 years ago
ok... found the answer to my own question: the installed version of paramiko 
(1.10) doesn't support ECDSA server keys. The OpenSSH client stored the ECDSA 
key in .know_hosts while paramiko checks the RSA key. It seems to be supported 
by later versions (1.15)

Original comment by michel.c...@gmail.com on 10 Oct 2014 at 2:04