Skip to content

Teleport connect on mac OS leaks domain sockets to SSH_AUTH_SOCK until ssh and teleport connect freezes #69549

Description

@andrew-h-teleport

Expected behavior:
Teleport connect (via the tsh daemon) should close socket connections opened on the mac OS system SSH agent ($SSH_AUTH_SOCK) when instances finish work.

Current behavior:
When teleport connect is running, the tsh daemon adds a new socket to $SSH_AUTH_SOCK for every use action in the teleport connect UI, and automatically by background polling that needs no user interaction. Socket connections accumulate until hitting macOS ssh-agent's limit, which I observed to be 248 connections.

Once the connection limit is reached:
ssh-agent stops responding on macOS and connect's resource list will appear to load indefinitely.
External commands using SSH will also hang.
Exiting from teleport connect releases the sockets.

Example of what teleport connect looks like when the limit is reached:
Image

Bug details:

  • Teleport version (tsh and connect): 18.10.3
  • Recreation steps:
    Open a macOS terminal, monitor open connections to $SSH_AUTH_SOCK:
while true; do echo "[$(date +'%H:%M:%S')] Open sockets: $(lsof "$SSH_AUTH_SOCK" 2>/dev/null | wc -l)"; sleep 5; done

Launch connect
Navigate around teleport connect (switch resource tabs, search servers/databases, switch clusters) for 5–10 minutes.
Observe the connection count until it caps out at 248.
Teleport connect will hang, other direct ssh commands will also hang
Quit teleport connect -> socket count will drop.

[12:03:50] Open connections to $SSH_AUTH_SOCK:      248
[12:03:55] Open connections to $SSH_AUTH_SOCK:      248
## <teleport connect process stopped here> ##
[12:04:00] Open connections to $SSH_AUTH_SOCK:        2
[12:04:05] Open connections to $SSH_AUTH_SOCK:        2

Metadata

Metadata

Assignees

No one assigned

    Labels

    teleport-connectIssues related to Teleport Connect.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions