Created attachment 2337 [details] Cache the host key and compare against it when re-keying Proposal: Cache server host key after initial key exchange Currently, whenever a key exchange is triggered, the host key offered by the server must be verified. This may involve DNS queries or requests to read the known hosts files. This can be problematic if StrictHostKeyChecking is set to "yes" and the verification fails due to a temporary problem, such as a corrupted /etc/ssh/ssh_known_hosts file. It should also be noted that with increasing file transfer rates and server-side support for time-based re-keying, the overhead of frequent host key verification becomes more of an issue. For example, consider an environment where /etc/ssh/ssh_known_hosts is centrally managed and is the primary source for verifying the authenticity of hosts. Further, assume that StrictHostKeyChecking is set to "yes" and that a damaged copy of the ssh_known_hosts file is distributed to the client systems. Existing ssh connections which re-key while the damaged file is in place will fail to re-key and will then disconnect. This will tend to impact high-bandwidth connections, such as large file transfers or busy X11 sessions. It can also impact regular login sessions if time-based re-keying is enabled. To avoid these issues, it might be worthwhile to cache the host key used during the initial key exchange. On subsequent key exchanges, the cached copy of the previously verified host key could be compared against the offered host key to avoid some of the overhead. An initial patch has been attached to this bug, but I'm not sure if it has unintended any side-effects.
Created attachment 2338 [details] Move code slightly and add a debug() statement
idea seems reasonable. I'm not sure I like the current implementation because the cached key is stored before all of the validation.
Created attachment 2341 [details] Cache the key after the initial check
One downside that just occurred to me: caching the key will skip revoked keys checks. I'm not sure whether this matters, since relying on rekeying to detect compromised keys is pretty hit and miss anyway.
Retarget incomplete bugs / feature requests to 6.6 release
Retarget to 6.7 release, since 6.6 was mostly bugfixing.
Remove from 6.6 tracking bug
Created attachment 2450 [details] updated patch Update to -current
*** Bug 2194 has been marked as a duplicate of this bug. ***
applied - this will be in openssh-6.7. Thanks!
Close all bugs left open from 6.6 and 6.7 releases.