Remove duplicate entries from the knownhosts entries list and from the known algorithms that are passed to key exchange

This is mostly inspired by the content of the file tests/home/bob/.ssh/known_hosts under the build dir, which gets several same host keys written in it during the testsuite run and which then caused long list of duplicate key types in the hostkey negotiation:

34: [  ERROR   ] --- ERROR: Invalid return code - kex error : no match for method server host key algo: server [rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp521], client [ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed25519,ssh-ed2,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256]

This patch set modifies the knownhost routines to knowingly remove duplicate entries and duplicate key types to avoid these issues including some tests to verify that it actually works.

Merge request reports

Loading