DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

timeout for dropbear

Open z3huti opened this issue 9 months ago • 1 comments

if SSH connection to dropbear was not closed properly, (happend to me when i had to go way from pc for a longer than i thought and pc went in sleep mode when SSH connection was running) that prosses wil run forever then on a server, unless you close it by hand or restart server

suggestion: in /etc/default/dropbear add DROPBEAR_EXTRA_ARGS="-I 300" or some other number in seconds

z3huti avatar May 25 '25 09:05 z3huti

Instead of killing open connection when idle, you probably want to kill them only if the network connection is actually dead. Use e.g. -K 75 to send a KeepAlive probe ever 75 seconds, and have the session killed after 3 probes fail.

OpenSSH uses the system's default KeepAlive by default, which is interesting:

net.ipv4.tcp_keepalive_time = 7200
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes = 9

So after 2 hours, the system starts to send KeepAlive probes at an interval of 75 seconds, and kills the connection after 9 failed probes. I am wondering whether this applies for Dropbear as well, hence whether Dropbear overrides the system default in any case, or only when -K is actually set, probably even being an additional probing feature, like ClientAliveInterval/ClientAliveCountMax by OpenSSH, disabled by default, and on SSH-level, not TCP-level.

In any case, for DietPi, I would try to stick to the OpenSSH default, hence falling back to system KeepAlive standards, instead of overriding something with Dropbear. Only if Dropbear forcefully disables system KeepAlive, set -K.

MichaIng avatar May 25 '25 13:05 MichaIng