mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 05:07:33 +00:00
ipn/ipnlocal,ssh/tailssh: reject c2n /update if SSH conns are active (#11820)
Since we already track active SSH connections, it's not hard to proactively reject updates until those finish. We attempt to do the same on the control side, but the detection latency for new connections is in the minutes, which is not fast enough for common short sessions. Handle a `force=true` query parameter to override this behavior, so that control can still trigger an update on a server where some long-running abandoned SSH session is open. Updates https://github.com/tailscale/corp/issues/18556 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
@@ -143,6 +143,13 @@ func (srv *server) trackActiveConn(c *conn, add bool) {
|
||||
delete(srv.activeConns, c)
|
||||
}
|
||||
|
||||
// NumActiveConns returns the number of active SSH connections.
|
||||
func (srv *server) NumActiveConns() int {
|
||||
srv.mu.Lock()
|
||||
defer srv.mu.Unlock()
|
||||
return len(srv.activeConns)
|
||||
}
|
||||
|
||||
// HandleSSHConn handles a Tailscale SSH connection from c.
|
||||
// This is the entry point for all SSH connections.
|
||||
// When this returns, the connection is closed.
|
||||
|
Reference in New Issue
Block a user