Created attachment 1323 [details] IdleTimeout option for ssh & sshd Hi, I took the idletimeout patch for sshd that Jani Jaakkola <jjaakkol@cs.helsinki.fi> made in 2001 (http://marc.info/?l=openssh-unix-dev&m=99838019319356&w=2) and updated it to work with 4.6p1. Then I added support for ssh as well. With this patch, an IdleTimeout option is added to both ssh and sshd, which disconnects when no traffic has passed for a predefined time. Time can be specified in seconds, minutes, hours, etc using character modifiers. The idea is to combine this patch with the ControlPersist patch (#1330) and create an easy way to have persistent ssh connections that clean up automatically. This speeds up scripts and generic admin work. Some comments: * In 2001 the code in packet.c was not organized like it is now with wrapper functions calling ssh1/ssh2 versions. I think I put calls to idletimeout_check() in the right places but I could have missed one or added too much. * For the writing case, I added an idletimeout_check() in packet_start instead of in the packet_send, assuming that packet_send will be called soon after packet_start. * If this patch is combined with the ControlPersist patch, it should be possible request that ssh only performs the timeout when ssh is daemonized as a master. This could be done by making ControlPersist take the same time value that IdleTimeout does. I'd be happy to code that?
Please see bug #1330 for a newer version of this patch that is combined with ControlPersist. The new version is saner and cleaner, and applies cleanly against 4.6p1 and the 2007-7-22 CVS.