ssh connection nornir_napalm via rsa

Viewed 263

I am quite new to nornir and network automation but I am in stuck with following scenario. ssh via using ssh key. Using access via password works without problem. My hosts.yaml look like this

---
  juniper-tst:
      hostname: 10.0.0.12
      port: 22
      username: mario
      platform: junos

But I keep getting this error

ncclient.transport.errors.AuthenticationError: SSHException('encountered RSA key, expected OPENSSH key',)

Now I am not sure if any extra optional argument is needed to be inserted in the hosts.yaml.

versions:

Python3.6
Nornir 3.1
1 Answers

This is related to the format of your private key. You should know that there are openssh format and PEM format. Both will work when connecting to openssh server but some libssh based applications may be picky (I had issue with zabbix ssh).

You are using the "PEM format" which starts with "-----BEGIN RSA PRIVATE KEY-----"

just generate an new set of keys with ssh-keygen which default to the OPENSSH format which starts with "-----BEGIN OPENSSH PRIVATE KEY-----"

Related