wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.85k stars 800 forks source link

Using wezterm to ssh stuck at `Authenticating...` #1567

Closed leira closed 2 years ago

leira commented 2 years ago

What Operating System(s) are you seeing this problem on?

macOS

WezTerm version

20220118-192644-60ea06e1

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I successfully logged into a remote linux machine using ssh. But when I tried to use wezterm to ssh, it stuck at Authenticating.... I'm not sure what exactly wezterm was waiting for. As there were not much information in the logs.

Screen Shot 2022-01-19 at 4 53 59 PM

Here is the configuration of the host in ~/.ssh/config. I use an id_ed25519 key pair.

  Host host
  HostName xxx.xxx.xxx
  User leira.hua
  AddKeysToAgent yes
  ForwardAgent yes
  ServerAliveInterval 60
  ServerAliveCountMax 3

  # Use GPU
  SetEnv CS_PROFILE=gpu

I tried to recreate the settings into an ssh domain, and use wezterm connect to connect to the host, it stuck in the same step.

  ssh_domains = {
    {
      name = "host",
      remote_address = "xxx.xxx.xxx",
      username = "leira.hua",
      multiplexing = "None",
      ssh_option = {
        identityfile = "$HOME/.ssh/id_ed25519.pub",
        AddKeyToAgent = "yes",
        ForwardAgent = "yes",

        -- Use GPU
        SetEnv = "CS_PORFILE=gpu",
      },
    },
  }

Please provide some help to collect more information and gain more insight.

To Reproduce

Use wezterm to ssh into a remote machine, with command:

> wezterm ssh -v host

Or configure the ssh domain, and use:

> wezterm connect host

Configuration

  ssh_domains = {
    {
      name = "host",
      remote_address = "xxx.xxx.xxx",
      username = "leira.hua",
      multiplexing = "None",
      ssh_option = {
        identityfile = "$HOME/.ssh/id_ed25519.pub",
        AddKeyToAgent = "yes",
        ForwardAgent = "yes",

        -- Use GPU
        SetEnv = "CS_PORFILE=gpu",
      },
    },
  }

Expected Behavior

Expect wezterm to successfully ssh into remote host.

Logs

❯ wezterm ssh -v *****
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_file > Reading configuration data from /Users/leira.hua/.ssh/config
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unsupported option: AddKeysToAgent, line: 4
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unsupported option: ForwardAgent, line: 5
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unsupported option: ServerAliveInterval, line: 6
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unsupported option: ServerAliveCountMax, line: 7
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unknown option: SetEnv, line: 10
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unapplicable option: LocalForward, line: 13
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_file > Reading configuration data from /etc/ssh/ssh_config
 2022-01-20T00:53:03.607Z INFO  libssh::local_parse_file      > Cannot find file /etc/ssh/ssh_config.d/* to load
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_config_parse_line > Unapplicable option: SendEnv, line: 55
 2022-01-20T00:53:03.607Z INFO  libssh::ssh_connect           > libssh 0.8.90 (c) 2003-2021 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_pthread
 2022-01-20T00:53:03.685Z INFO  libssh::ssh_socket_connect    > Nonblocking connection socket: 16
 2022-01-20T00:53:03.685Z INFO  libssh::ssh_connect           > Socket connecting, now waiting for the callbacks to work
 2022-01-20T00:53:03.685Z INFO  libssh::ssh_connect           > Actual timeout : 10000
 2022-01-20T00:53:03.723Z INFO  wezterm_gui::termwindow       > OpenGL initialized! AMD Radeon Pro 5300M OpenGL Engine 4.1 ATI-4.7.101 is_context_loss_possible=false wezterm version: 20220118-192644-60ea06e1
 2022-01-20T00:53:03.728Z INFO  libssh::ssh_socket_pollcallback > Received POLLOUT in connecting state
 2022-01-20T00:53:03.728Z INFO  libssh::socket_callback_connected > Socket connection callback: 1 (0)
 2022-01-20T00:53:03.728Z INFO  libssh::ssh_socket_unbuffered_write > Enabling POLLOUT for socket
 2022-01-20T00:53:03.760Z INFO  libssh::callback_receive_banner     > Received banner: SSH-2.0-v0.51.0
 2022-01-20T00:53:03.760Z INFO  libssh::ssh_client_connection_callback > SSH server banner: SSH-2.0-v0.51.0
 2022-01-20T00:53:03.760Z INFO  libssh::ssh_analyze_banner             > Analyzing banner: SSH-2.0-v0.51.0
 2022-01-20T00:53:03.764Z INFO  libssh::ssh_client_select_hostkeys     > Order of wanted host keys: "ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256"
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_client_select_hostkeys     > Algorithms found in known_hosts files: "ssh-ed25519"
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_client_select_hostkeys     > Changing host key method to "ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256"
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_socket_unbuffered_write    > Enabling POLLOUT for socket
 2022-01-20T00:53:03.765Z INFO  libssh::packet_send2                   > packet: wrote [type=20, len=812, padding_size=11, comp=800, payload=800]
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_send_kex                   > SSH_MSG_KEXINIT sent
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_packet_socket_callback     > packet: read type 20 [len=524,padding=19,comp=504,payload=504]
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_packet_process             > Dispatching handler for packet type 20
 2022-01-20T00:53:03.765Z INFO  libssh::ssh_kex_select_methods         > Negotiated curve25519-sha256@libssh.org,ssh-ed25519,chacha20-poly1305@openssh.com,chacha20-poly1305@openssh.com,aead-poly1305,aead-poly1305,none,none,,
 2022-01-20T00:53:03.767Z INFO  libssh::packet_send2                   > packet: wrote [type=30, len=44, padding_size=6, comp=37, payload=37]
 2022-01-20T00:53:03.767Z INFO  libssh::ssh_socket_unbuffered_write    > Enabling POLLOUT for socket
 2022-01-20T00:53:03.835Z INFO  libssh::ssh_packet_socket_callback     > packet: read type 31 [len=188,padding=8,comp=179,payload=179]
 2022-01-20T00:53:03.835Z INFO  libssh::ssh_packet_process             > Dispatching handler for packet type 31
 2022-01-20T00:53:03.838Z INFO  libssh::ssh_socket_unbuffered_write    > Enabling POLLOUT for socket
 2022-01-20T00:53:03.838Z INFO  libssh::packet_send2                   > packet: wrote [type=21, len=12, padding_size=10, comp=1, payload=1]
 2022-01-20T00:53:03.839Z INFO  libssh::crypt_set_algorithms2          > Set output algorithm to chacha20-poly1305@openssh.com
 2022-01-20T00:53:03.839Z INFO  libssh::crypt_set_algorithms2          > Set HMAC output algorithm to aead-poly1305
 2022-01-20T00:53:03.839Z INFO  libssh::crypt_set_algorithms2          > Set input algorithm to chacha20-poly1305@openssh.com
 2022-01-20T00:53:03.839Z INFO  libssh::crypt_set_algorithms2          > Set HMAC input algorithm to aead-poly1305
 2022-01-20T00:53:03.839Z INFO  libssh::ssh_init_rekey_state           > Set rekey after 134217728 blocks
 2022-01-20T00:53:03.839Z INFO  libssh::ssh_init_rekey_state           > Set rekey after 134217728 blocks
 2022-01-20T00:53:03.839Z INFO  libssh::ssh_packet_client_curve25519_reply > SSH_MSG_NEWKEYS sent
 2022-01-20T00:53:03.839Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 21 [len=12,padding=10,comp=1,payload=1]
 2022-01-20T00:53:03.839Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 21
 2022-01-20T00:53:03.839Z INFO  libssh::ssh_packet_newkeys                 > Received SSH_MSG_NEWKEYS
 2022-01-20T00:53:03.841Z INFO  libssh::ssh_packet_newkeys                 > Signature verified and valid
 2022-01-20T00:53:03.841Z INFO  libssh::ssh_connect                        > current state : 7
 2022-01-20T00:53:03.841Z INFO  libssh::ssh_socket_unbuffered_write        > Enabling POLLOUT for socket
 2022-01-20T00:53:03.841Z INFO  libssh::packet_send2                       > packet: wrote [type=5, len=24, padding_size=6, comp=17, payload=17]
 2022-01-20T00:53:03.841Z INFO  libssh::ssh_service_request                > Sent SSH_MSG_SERVICE_REQUEST (service ssh-userauth)
 2022-01-20T00:53:03.906Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 6 [len=24,padding=6,comp=17,payload=17]
 2022-01-20T00:53:03.906Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 6
 2022-01-20T00:53:03.906Z INFO  libssh::ssh_packet_service_accept          > Received SSH_MSG_SERVICE_ACCEPT
 2022-01-20T00:53:03.906Z INFO  libssh::ssh_socket_unbuffered_write        > Enabling POLLOUT for socket
 2022-01-20T00:53:03.906Z INFO  libssh::packet_send2                       > packet: wrote [type=50, len=48, padding_size=7, comp=40, payload=40]
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 53 [len=920,padding=4,comp=915,payload=915]
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 53
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_userauth_banner         > Received SSH_USERAUTH_BANNER packet
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_socket_callback         > Processing 44 bytes left in socket buffer
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 51 [len=24,padding=8,comp=15,payload=15]
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 51
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_userauth_failure        > Access denied for 'none'. Authentication that can continue: publickey
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_packet_userauth_failure        > Access denied for 'none'. Authentication that can continue: publickey
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_agent_get_ident_count          > Answer type: 12, expected answer: 12
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_agent_get_ident_count          > Agent count: 1
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_userauth_agent                 > Trying identity leira.hua@************
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_key_algorithm_allowed          > Checking ssh-ed25519 with list <ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256>
 2022-01-20T00:53:03.941Z INFO  libssh::ssh_socket_unbuffered_write        > Enabling POLLOUT for socket
 2022-01-20T00:53:03.941Z INFO  libssh::packet_send2                       > packet: wrote [type=50, len=128, padding_size=11, comp=116, payload=116]
 2022-01-20T00:53:04.034Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 60 [len=80,padding=8,comp=71,payload=71]
 2022-01-20T00:53:04.034Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 60
 2022-01-20T00:53:04.034Z INFO  libssh::ssh_userauth_agent                 > Public key of leira.hua@************ accepted by server
 2022-01-20T00:53:04.034Z INFO  libssh::ssh_key_algorithm_allowed          > Checking ssh-ed25519 with list <ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256>
 2022-01-20T00:53:04.037Z INFO  libssh::ssh_socket_unbuffered_write        > Enabling POLLOUT for socket
 2022-01-20T00:53:04.037Z INFO  libssh::packet_send2                       > packet: wrote [type=50, len=208, padding_size=4, comp=203, payload=203]
 2022-01-20T00:53:04.094Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 52 [len=8,padding=6,comp=1,payload=1]
 2022-01-20T00:53:04.094Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 52
 2022-01-20T00:53:04.094Z INFO  libssh::ssh_packet_userauth_success        > Authentication successful
 2022-01-20T00:53:04.094Z INFO  libssh::ssh_packet_need_rekey              > rekey: [data_rekey_needed=0, out_blocks=46, in_blocks=125]
 2022-01-20T00:53:04.095Z INFO  libssh::channel_open                       > Creating a channel 43 with 64000 window and 32768 max packet
 2022-01-20T00:53:04.095Z INFO  libssh::ssh_packet_need_rekey              > rekey: [data_rekey_needed=0, out_blocks=49, in_blocks=128]
 2022-01-20T00:53:04.095Z INFO  libssh::ssh_socket_unbuffered_write        > Enabling POLLOUT for socket
 2022-01-20T00:53:04.095Z INFO  libssh::packet_send2                       > packet: wrote [type=90, len=32, padding_size=7, comp=24, payload=24]
 2022-01-20T00:53:04.095Z INFO  libssh::channel_open                       > Sent a SSH_MSG_CHANNEL_OPEN type session for channel 43
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_socket_callback         > packet: read type 91 [len=24,padding=6,comp=17,payload=17]
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_process                 > Dispatching handler for packet type 91
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_channel_open_conf       > Received SSH2_MSG_CHANNEL_OPEN_CONFIRMATION
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_channel_open_conf       > Received a CHANNEL_OPEN_CONFIRMATION for channel 43:0
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_channel_open_conf       > Remote window : 2097152, maxpacket : 32768
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_need_rekey              > rekey: [data_rekey_needed=0, out_blocks=49, in_blocks=127]
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_packet_need_rekey              > rekey: [data_rekey_needed=0, out_blocks=56, in_blocks=134]
 2022-01-20T00:53:04.131Z INFO  libssh::ssh_socket_unbuffered_write        > Enabling POLLOUT for socket
 2022-01-20T00:53:04.131Z INFO  libssh::packet_send2                       > packet: wrote [type=98, len=64, padding_size=7, comp=56, payload=56]
 2022-01-20T00:53:04.131Z INFO  libssh::channel_request                    > Sent a SSH_MSG_CHANNEL_REQUEST pty-req

Anything else?

No response

leira commented 2 years ago

Here is the log from a successful ssh login:

❯ ssh -v host
OpenSSH_8.6p1, LibreSSL 2.8.3
debug1: Reading configuration data /Users/leira.hua/.ssh/config
debug1: /Users/leira.hua/.ssh/config line 1: Applying options for host
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to xxx.xxx.xxx port 22.
debug1: Connection established.
debug1: identity file /Users/leira.hua/.ssh/id_rsa type -1
debug1: identity file /Users/leira.hua/.ssh/id_rsa-cert type -1
debug1: identity file /Users/leira.hua/.ssh/id_dsa type -1
debug1: identity file /Users/leira.hua/.ssh/id_dsa-cert type -1
debug1: identity file /Users/leira.hua/.ssh/id_ecdsa type -1
debug1: identity file /Users/leira.hua/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/leira.hua/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/leira.hua/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/leira.hua/.ssh/id_ed25519 type 3
debug1: identity file /Users/leira.hua/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/leira.hua/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/leira.hua/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/leira.hua/.ssh/id_xmss type -1
debug1: identity file /Users/leira.hua/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version v0.51.0
debug1: compat_banner: no match: v0.51.0
debug1: Authenticating to xxx.xxx.xxx:22 as 'leira.hua'
debug1: load_hostkeys: fopen /Users/leira.hua/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:w4v42H55/G/XlxEwK2XFICW9cP0IdCV2XXoEW5JAe3E
debug1: load_hostkeys: fopen /Users/leira.hua/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'xxx.xxx.xxx' is known and matches the ED25519 host key.
debug1: Found key in /Users/leira.hua/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/leira.hua/.ssh/id_ed25519 ED25519 
SHA256:******************************************* agent
debug1: Will attempt key: /Users/leira.hua/.ssh/id_rsa
debug1: Will attempt key: /Users/leira.hua/.ssh/id_dsa
debug1: Will attempt key: /Users/leira.hua/.ssh/id_ecdsa
debug1: Will attempt key: /Users/leira.hua/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/leira.hua/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/leira.hua/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received

****************************************
Fancy Banner
****************************************

****** ****** v******
Authenticating...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/leira.hua/.ssh/id_ed25519 ED25519
SHA256:******************************************* agent
debug1: Server accepts key: /Users/leira.hua/.ssh/id_ed25519 ED25519
SHA256:******************************************* agent
debug1: Authentication succeeded (publickey).
Authenticated to ***.***.*** ([**.**.**.**]:22).
debug1: Local connections to LOCALHOST:8765 forwarded to remote address localhost:8765
debug1: Local forwarding listening on 127.0.0.1 port 8765.
bind [127.0.0.1]:8765: Address already in use
debug1: Local forwarding listening on ::1 port 8765.
bind [::1]:8765: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 8765
Could not request local forwarding.
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: filesystem full
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: client_input_channel_open: ctype auth-agent@openssh.com rchan 1 win 2097152 max 32768
debug1: channel 1: new [authentication agent connection]
debug1: confirm auth-agent@openssh.com
debug1: channel 1: free: authentication agent connection, nchannels 2
Getting your home disk... Done! [0s]
leira commented 2 years ago

Chatted with @wez in the Matrix channel. It seems because libssh doesn't support "ForwardAgent".

leira commented 2 years ago

So I'm trying another approach, to have wezterm-mux-server to create a socket file. Then use an ssh tunnel to forward the socket file. Then let wezterm to connect the local socket file.

I tested the scenario locally without an ssh tunnel. I started a wezterm-mux-server using a socket file, then let wezterm connects to the same socket file, it worked. But with ssh tunnel, it failed as "open failed: unknown channel type: unsupported channel type".

  1. on the server side, create a wezterm.lua, with these lines:
    return {
    unix_domains = {
    {
      name = "unix",
      socket_path = "/home/leira.hua/.local/share/wezterm/sock"
    }
    },
    }
  2. runwezterm-tmux-server on server side, it prints:
    2022-01-20T06:23:43.677Z INFO  wezterm_mux_server_impl::local > setting up /home/leira.hua/.local/share/wezterm/sock
  3. on the client machine, add a unix domain:
    unix_domains = {
    {
      name = "host",
      socket_path = "/tmp/wezterm_sock",
    },
    },
  4. Start another ssh connect from client to sever:
    ssh -vnNT -L /tmp/wezterm_sock:/home/leira.hua/.local/share/wezterm/sock -o "ExitOnForwardFailure yes" host
  5. Connect from local machine with wezterm connect host. It failed. On the ssh tunnel side, it prints:
    debug1: Connection to port -2 forwarding to /home/leira.hua/.local/share/wezterm/sock port -2 requested.
    debug1: channel 3: new [direct-streamlocal@openssh.com]
    channel 3: open failed: unknown channel type: unsupported channel type
    debug1: channel 3: free: direct-streamlocal@openssh.com: listening port -2 for /home/leira.hua/.local/share/wezterm/sock port -2, connect from  port 0 to /tmp/wezterm_sock port 0, nchannels 4

It seems the unix socket file forwarding I setup has some issue with.

leira commented 2 years ago

I recreated the scenario with socat, I got the same error. I think the ssh socket file forwarding was not correct.

  1. Run socat - unix-listen:/tmp/socat_sock_remote on the remote machine.
  2. Build a tunnel with ssh -v -L /tmp/socat_sock:/tmp/socat_sock_remote -o "ExitOnForwardFailure yes" cruise.
  3. Run socat - unix-client:/tmp/socat_sock. I got the same error:
    debug1: Connection to port -2 forwarding to /tmp/socat_sock_remote port -2 requested.
    debug1: channel 4: new [direct-streamlocal@openssh.com]
    channel 4: open failed: unknown channel type: unsupported channel type
leira commented 2 years ago

I think it is now clear that the issue is with libssh not supporting ForwardAgent. It is an issue with the upstream.

A solution to this is to support running wezterm across ssh without wezterm as the ssh client.

Duplicate of #1568.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.