Skip to content

Gateway tunnel fails when the container user has no name #59

Description

@czpython

DockerSbxProvider.open_gateway_tunnel (#57) calls asyncssh.connect with username=, but asyncssh also looks up the local user name. The gateway container runs as a uid with no passwd entry (for example user: 1000:1000, to reach the sbx socket), and USER is not set. The lookup fails, and the gateway closes the whole client connection:

Accepted direct TCP connection request to 127.0.0.1, port 43123
[chan=0] Closing channel due to connection close
[chan=0] Channel closed: Unknown local username: set one of LOGNAME, USER, LNAME, or USERNAME in the environment

The error is not a ProviderError, so connection_requested does not turn it into a ChannelOpenError. The client loses the connection, and every later command on it fails with ChannelOpenError: SSH connection closed.

Reproduce

Run the gateway as a uid with no passwd entry and no USER. Open a direct-tcpip channel to 127.0.0.1 on a docker-sbx host.

Expected

  • open_gateway_tunnel passes local_username, so it does not depend on the environment.
  • A tunnel failure of any type closes only the channel, not the client connection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions