Usually, sshfp records are being generated if the host is being joined to the ipa-domain either by hand or by a provisioning workflow provided by foreman for example. If you have to regenerate them, however, they won't match and you'll get the warning that the keys don't match, rightfully so.
In order to fix this, you just need to modify the host with the current public keys and pass the '--updatedns'-option to the ipa command.
First, let's make sure that all the ssh-host keys are newly generated:
[root@server ~]# find /etc/ssh/ -type f -name '*ssh_host_*_key.pub' -delete
[root@server ~]# ssh-keygen -A
The keys won't match now and if you log out and in again, you'll get the warning I mentioned earlier. Now, let's regenerate the records. The ssh-keygen will also create a DSA key which is strongly advised against using since they're mathematically broken. So, we're just going to print out the ECDSA, ED25519, and RSA keys:
[root@server ~]# find /etc/ssh -type f -regextype posix-egrep -regex '.*/ssh_host_(ecdsa|ed25519|rsa)_key.pub' -exec cat {} \;
Log in as admin or any other user having administrator privileges and modify the host:
[root@server ~]# kinit admin
[root@server ~]# ipa host-mod $(hostname -f) --updatedns --sshpubkey='ecdsa-sha2-nistp256 ...' --sshpubkey='ssh-ed25519 ...' --sshpubkey='ssh-rsa ...'
The '--updatedns' will trigger a regeneration of the sshfp records. Once you log out and log in again, the host-key warning should be gone.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment