Problem

You are unable to commit configuration changes on CPE branch devices, and the Bad Private key error message is displayed.


When you try to sync the Director configuration with the branch, you may encounter the following error: 

Remote Server Exception view details
malformed-message : Failed to authenticate towards device GIMEC-LAB-CPE2: Bad private SSH key for local/remote user arun.c/admin

As a result, you cannot commit any configuration changes on the CPE branch devices. 


This problem may arise for one of the following reasons: 

  • If the host IP address has moved from one device to another, when the Director node updates the keys of the old IP addresses and tries to authenticate the host using the same keys, the keys fail to authenticate the IP addresses. 
  • The FlexVNF device has lost its Versa Director keys.

Solution

To fix this problem:

  1. Issue the shell command  sudo /opt/versa/vnms/scripts/push_keys_to_device.sh IP-Address device-password to push the key from Versa Director to the affected FlexVNF branch device. ip-addressis the IP address of the FlexVNF device. For example:
    Administrator@Director:~$ sudo /opt/versa/vnms/scripts/push_keys_to_device.sh 10.3.64.229 ******
    [sudo] password for admin:
    Warning: Permanently added '10.3.64.229' (ECDSA) to the list of known hosts.
    0 0
    admin@DIRECTOR:~$


  2. Issue the request devices fetch-ssh-host-keys device device-name CLI command to fetch the keys from the FlexVNF branch device. For example:
    Administrator@Director-New> request devices fetch-ssh-host-keys device Branch-2
    fetch-result {
        device Branch-2
        result unchanged
        fingerprint {
            algorithm ssh-dss
            value 2a:5c:1b:d1:4c:31:cd:37:35:a7:27:25:be:dd:f3:b7
        }
    } 


  3. If there are multiple entries found under /home/admin/.ssh/authorized_keys you can truncate the file follow the step1. This will delete the Old Keys and push the new Key from Versa Director. For example: Issue the truncate -s 0 /home/admin/.ssh/authorized_keys

    [admin@IND-DEL-2019013367-DELHI-1: ~] $ cat /home/admin/.ssh/authorized_keys
    ssh-dss AAAAB3NzaC1kc3MAAACBAIxT+EyQT99QPlFhn4VtIIZCPwmt9mECZxxqdynqbskqXIyXiOrN4pu1gyvWDaebxpufcPlPkp4wZXuyZCTBh/hNmadEleQfO3jb2xwsosynOhPUF1GoUpgxuSJRCPH/RrCOKc9qo68uKAnuVxQSKj8JF/MWMzPGp1oATWyvgl51AAAAFQDzU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k+Vo1PQdHlpWxqgPJEu5BAm3IzSe616KdAAyeH2UOHCR7XEuc712EoACsmbPlXhev/FxDhk88btAOhoCDwCp8m9OI+g+wtT7NhRdwpNyTwygg9Rxj8SlUDYO7+729bGnl21f1lHiovXRUDyx9OlqlRGtALJLgLz68Zw83kVOSORQ9u2NlMW0uukkq0J6k2EBFrwUhAUS1p2MknRXaYu0d root@VD-LIL-IN-01-STX-STG
    
    To truncate the /home/admin/.ssh/authorized_keys
    
    [admin@DUALCPE2: ~] $ truncate -s 0 /home/admin/.ssh/authorized_keys