Bug 1619626

Summary: Host creds validation fails if host's ssh key has changed before
Product: Red Hat CloudForms Management Engine Reporter: Radim Hrazdil <rhrazdil>
Component: ProvidersAssignee: Martin Perina <mperina>
Status: CLOSED CURRENTRELEASE QA Contact: Angelina Vasileva <anikifor>
Severity: low Docs Contact:
Priority: medium    
Version: 5.9.4CC: anikifor, dmetzger, gblomqui, jfrey, jhardy, mfeifer, obarenbo
Target Milestone: GAKeywords: AutomationBlocker
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1624700 (view as bug list) Environment:
Last Closed: 2019-06-11 15:26:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1624700    
Attachments:
Description Flags
evm.log none

Description Radim Hrazdil 2018-08-21 10:53:21 UTC
Created attachment 1477486 [details]
evm.log

Description of problem:

If a host without validated credentials has it's ssh keys changed, it is no longer possible to validate the credentials after the ssh keys have changed.

When you attempt to validate host credentials (and ssh key of the host has changed since it's provider was added to cfme appliance), cfme asks if it should accept the new public key, but it seems that it fails to do so. Subsequently, the validation fails with 'No credentials defined' error message.


Version-Release number of selected component (if applicable):
5.9.4.4.20180816162527_c00eb23
RHV Version:4.2.6.3-0.1.el7ev

How reproducible:
100%

Steps to Reproduce:
0. Have cfme appliance with added RHV provider, Host without validated creds
1. Let's assume that at this point ssh keys of a host are updated:
    -- # ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
    -- # ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t dsa
    -- # /sbin/service sshd restart
2. Try to validate credentials of the host with refreshed keys
3. CFME asks whether new keys should be accepter, click OK

Actual results:
'No credentials defined' error message.

Expected results:
New keys should be accepted and credentials successfully validated. 

Additional info:

If the host with regenerated ssh key has had been validated before, cfme accepts the new keys successfully and creds are validated. The error only occurs when ssh keys change on previously unvalidated host.

Easy workaround is to remove the old host key from known_hosts.