SSH:TDG
SSH: The Secure Shell (The Definitive Guide)
Barrett, Silverman, & Byrnes / O’Reilly

SSH Frequently Asked Questions

When using SSH-2.3.0 with any other SSH implementation (in either client/server combination), the session dies after an hour. There are various error messages; OpenSSH, for example, says this:

Hm, dispatch protocol error: type 20 plen ...


Beginning with version 2.3.0, SSH2 implements session rekeying. This is a feature of the SSH-2 protocol which allows either side to force another run of the key-exchange phase, changing the encryption and integrity keys for the session. The idea is to do this periodically, every so many seconds or after so many bytes of data have passed over the connection. The feature is controlled by the SSH2 configuration parameter RekeyIntervalSeconds, whose default value is 3600 (1 hour, on both the client and server sides).

The problem is that no other SSH-2 implementation currently does session rekeying, and they die in various ways when they receive the rekeying message from SSH2. Since rekeying is not optional (the receiving side can't refuse to do it), the only sure way to avoid this is to turn off rekeying in SSH2: set RekeyIntervalSeconds to 0 (in /etc/ssh2/sshd2_config for the server, or ~/.ssh2/ssh2_config for the client).

SSH-2.4.0 includes code to recognize when it's speaking to OpenSSH, and disables session rekeying when it does.