I am doing some tests around ssh. From what I have seen a server usually has multiple host keys. When a client tries to connect, it tries to negotiate which key types to use DSA
, RSA
, ECDSA
, etc. But on key signature confirmation by the user, those host keys are added to known_hosts
.
This brings up my problem:
I am sure I saw in known_hosts
keys for github both for RSA
and ECDSA
(or ed25519
). Now when I connect to github it only adds the RSA
key. If I tweak the preferred algorithm with HostKeyAlgorithms
and set it to ed25519
only, it obviously refuses to connect with WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
.
I tested with a local openssh server and indeed it adds all the host keys. Why does github behave differently?
Config file:
Host *
ServerAliveInterval 60
HostKeyAlgorithms rsa-sha2-512,rsa-sha2-256,ssh-ed25519