Client disconnects after 240s if server timeout is set to 300s
I've set the server timeout to 300 seconds (--timeout 300), but now I'm seeing the clients always disconnect after 240s. This looks like the initial client timeout. IIUC the server should update the client timeout to twice the server timeout. Is this timeout info sent with the server keep-alive packet? And is the keep-alive packet sent timeout seconds after connection establishment? This then would explain that if I set the server timeout (300s) to a value higher than the initial timeout (240s), the client times out before ever receiving the timeout update.
If that is the case, wouldn't it make sense to transmit the server timeout value to the client upon connection establishment?
Hm, this is a bit odd as the client does actually update its own timeout based on the servers timeout setting.
https://github.com/NHAS/reverse_ssh/blob/663d5d736037e760a940401062d0c750ea7bc87b/internal/client/client.go#L396
case "[email protected]":
req.Reply(false, nil)
timeout, err := strconv.Atoi(string(req.Payload))
if err != nil {
continue
}
realConn.Timeout = time.Duration(timeout*2) * time.Second
If I set the timeout to 120, everything works fine. Is there anything I can do to help debug this?
Hm, other than ensuring that the client is getting the right timeout value via the keepalive I cant really think of much.