Files
teleport/api/utils/sshutils
rosstimothy 514bfc7ac6 Ensure invalid tunnel agent connections get closed (#17899)
* Ensure invalid tunnel agent connections get closed

Connections from reverse tunnel agents were being marked
as invalid by the proxy under certain conditions but would
ultimately never be closed. This could lead to scenarios where
the agent thought things were fine but the proxy considered
that agent unhealthy and unroutable.

Pruning of invalid connections used to occur when a proxy
tried to retrieve a connection for that tunnel. This also
further muddied the point in time at which the proxy could
close a connection as it never explicitly stopped tracking
the connection and closed it at the same time.

To remedy this, connections are explicitly closed by the proxy
and removed from the mapping to stop tracking immediately. In order
to prevent a connection that is servicing an active connection
from being closed the proxy now tracks which connections have
sessions. Closing does not occur when there are any active
sessions to prevent them from being force terminated.

When the proxy receives a heartbeat from an agent it now restores
the connection to a valid state. In the event that too many heart
beats have been missed for an agent, the proxy will now terminate
the connection, again only if it is not serving any sessions.

Fixes #15911
2022-11-04 18:05:13 +00:00
..
2022-09-23 19:44:10 +00:00
2022-10-28 20:20:28 +00:00
2022-10-28 20:20:28 +00:00
2022-10-28 20:20:28 +00:00
2022-10-28 20:20:28 +00:00
2022-10-28 20:20:28 +00:00
2022-10-28 20:20:28 +00:00