aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-03-29 17:05:35 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-03-29 17:05:35 +0000
commitf2fdd8ebdb1617218201d16eeb54a5a905768764 (patch)
treebd04897a6f67ac6d8af3c60768bff70e848d66ac
parentdd5a12c5a10953000a3b29e9801b429523d8ae65 (diff)
downloadupstream-f2fdd8ebdb1617218201d16eeb54a5a905768764.tar.gz
upstream-f2fdd8ebdb1617218201d16eeb54a5a905768764.tar.bz2
upstream-f2fdd8ebdb1617218201d16eeb54a5a905768764.zip
dropbear: add options SSHKeepAlive and IdleTimeout.
Without timeout mechanism, if ssh client disconnected without sending FIN or RST, forked dropbear servers would hang there for KEX_RETRY_TIMEOUT seconds (8 hours). TCP keepalive is not implemented in dropbear yet, thus the name SSHKeepAlive. 300 seconds in this patch is selected from the default value of ServerAliveInterval for Debian ssh client (See man ssh_config). Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> SVN-Revision: 40299
-rwxr-xr-xpackage/network/services/dropbear/files/dropbear.init6
1 files changed, 5 insertions, 1 deletions
diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
index 93dc3d9694..19aab3653b 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -44,7 +44,9 @@ validate_section_dropbear()
'rsakeyfile:file' \
'dsskeyfile:file' \
'BannerFile:file' \
- 'Port:list(port):22'
+ 'Port:list(port):22' \
+ 'SSHKeepAlive:uinteger:300' \
+ 'IdleTimeout:uinteger:0'
return $?
}
@@ -74,6 +76,8 @@ dropbear_instance()
[ -n "${BannerFile}" ] && procd_append_param command -b "${BannerFile}"
[ -n "${Interface}" ] && network_get_device Interface "${Interface}"
append_ports "${Interface}" "${Port}"
+ [ "${IdleTimeout}" -ne 0 ] && procd_append_param command -I "${IdleTimeout}"
+ [ "${SSHKeepAlive}" -ne 0 ] && procd_append_param command -K "${SSHKeepAlive}"
procd_close_instance
}