blinksh / blink

Blink Mobile Shell for iOS (Mosh based)
https://blink.sh
GNU General Public License v3.0
6.15k stars 572 forks source link

Hostname + Tailscale + Socket error: disconnected #1000

Closed bs closed 8 months ago

bs commented 4 years ago

Some unusual behavior in setting up blink.sh + ssh + custom hostname + Tailscale on my iPad and Mac.

ssh2 (and then mosh -2) work fine when using a hostname, but ssh and mosh fail.

Doesn't work

Works

Details

ssh -vvvvvv IP_OF_HOST 2> log.txt reports:

ssh_connect: libssh 0.9.3 (c) 2003-2019 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
ssh_connect: Socket connecting, now waiting for the callbacks to work
-[IO stream:handleEvent:]: Received POLLOUT in connecting state
socket_callback_connected: Socket connection callback: 1 (0)
ssh_connect: current state : 2
callback_receive_banner: Received banner: SSH-2.0-OpenSSH_8.1
ssh_client_connection_callback: SSH server banner: SSH-2.0-OpenSSH_8.1
ssh_analyze_banner: Analyzing banner: SSH-2.0-OpenSSH_8.1
ssh_analyze_banner: We are talking to an OpenSSH client version: 8.1 (80100)
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,ssh-rsa,ssh-dss"
ssh_key_cmp: key types don't match!
ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory
ssh_client_select_hostkeys: Algorithms found in known_hosts files: "ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa"
ssh_client_select_hostkeys: Changing host key method to "ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,ssh-dss"
packet_send2: packet: wrote [type=20, len=980, padding_size=10, comp=969, payload=969]
ssh_send_kex: SSH_MSG_KEXINIT sent
ssh_packet_socket_callback: packet: read type 20 [len=1076,padding=6,comp=1069,payload=1069]
ssh_packet_process: Dispatching handler for packet type 20
ssh_kex_select_methods: Negotiated curve25519-sha256,ssh-ed25519,aes256-gcm@openssh.com,aes256-gcm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-256-etm@openssh.com,zlib@openssh.com,zlib@openssh.com,,
packet_send2: packet: wrote [type=30, len=44, padding_size=6, comp=37, payload=37]
ssh_connect: current state : 6
ssh_packet_socket_callback: packet: read type 31 [len=188,padding=8,comp=179,payload=179]
ssh_packet_process: Dispatching handler for packet type 31
packet_send2: packet: wrote [type=21, len=12, padding_size=10, comp=1, payload=1]
crypt_set_algorithms2: Set output algorithm to aes256-gcm@openssh.com
crypt_set_algorithms2: Set HMAC output algorithm to aead-gcm
crypt_set_algorithms2: Set input algorithm to aes256-gcm@openssh.com
crypt_set_algorithms2: Set HMAC input algorithm to aead-gcm
ssh_init_rekey_state: Set rekey after 4294967296 blocks
ssh_init_rekey_state: Set rekey after 4294967296 blocks
ssh_packet_client_curve25519_reply: SSH_MSG_NEWKEYS sent
ssh_packet_socket_callback: Processing 196 bytes left in socket buffer
ssh_packet_socket_callback: packet: read type 21 [len=12,padding=10,comp=1,payload=1]
ssh_packet_process: Dispatching handler for packet type 21
ssh_packet_newkeys: Received SSH_MSG_NEWKEYS
ssh_packet_newkeys: Signature verified and valid
ssh_packet_socket_callback: Processing 180 bytes left in socket buffer
ssh_packet_socket_callback: packet: read type 7 [len=160,padding=18,comp=141,payload=141]
ssh_packet_process: Dispatching handler for packet type 7
ssh_packet_ext_info: Received SSH_MSG_EXT_INFO
ssh_packet_ext_info: Follows 1 extensions
ssh_packet_ext_info: Extension: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
ssh_connect: current state : 7
ssh_key_cmp: key types don't match!
packet_send2: packet: wrote [type=5, len=32, padding_size=14, comp=17, payload=17]
ssh_service_request: Sent SSH_MSG_SERVICE_REQUEST (service ssh-userauth)
ssh_packet_socket_callback: packet: read type 6 [len=32,padding=14,comp=17,payload=17]
ssh_packet_process: Dispatching handler for packet type 6
ssh_packet_service_accept: Received SSH_MSG_SERVICE_ACCEPT
packet_send2: packet: wrote [type=50, len=48, padding_size=11, comp=36, payload=36]
ssh_packet_socket_callback: packet: read type 51 [len=64,padding=18,comp=45,payload=45]
ssh_packet_process: Dispatching handler for packet type 51
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey,password,keyboard-interactive
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey,password,keyboard-interactive
ssh_pki_import_privkey_base64: Trying to decode privkey passphrase=false
ssh_key_algorithm_allowed: Checking rsa-sha2-512 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-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
ssh_key_algorithm_allowed: Checking rsa-sha2-512 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-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
packet_send2: packet: wrote [type=50, len=608, padding_size=10, comp=597, payload=597]
ssh_packet_socket_callback: packet: read type 51 [len=64,padding=18,comp=45,payload=45]
ssh_packet_process: Dispatching handler for packet type 51
ssh_packet_userauth_failure: Access denied for 'publickey'. Authentication that can continue: publickey,password,keyboard-interactive
ssh_packet_userauth_failure: Access denied for 'publickey'. Authentication that can continue: publickey,password,keyboard-interactive
ssh_userauth_kbdint_init: Sending keyboard-interactive init request
packet_send2: packet: wrote [type=50, len=80, padding_size=19, comp=60, payload=60]
ssh_packet_socket_callback: packet: read type 60 [len=48,padding=16,comp=31,payload=31]
ssh_packet_process: Dispatching handler for packet type 60
ssh_packet_userauth_info_request: 1 keyboard-interactive prompts
ssh_userauth_kbdint_send: Sending keyboard-interactive response packet
packet_send2: packet: wrote [type=61, len=16, padding_size=6, comp=9, payload=9]

Followed by this to stdout:

blink: setting socket keepalive: 1
blink: using auth methods attempt: 1 of 5
blink: import key id_rsa
blink: warning: no key found: 'id_dsa' 
blink: warning: no key found: 'id_ecdsa' 
blink: warning: no key found: 'id_ed25519' 
Password:

Trying with the hostname (the source of this rabbit hole!) gives:

ssh -vvvvv lappy
ssh_connect: libssh 0.9.3 (c) 2003-2019 Aris Adamantiadis, Andreas Schneider and libssh contributors. Distrib
uted under the LGPL, please refer to COPYING file for information about your rights, using threading threads_
pthread
ssh_socket_connect_proxycommand: Executing proxycommand ' '
ssh_socket_connect_proxycommand: ProxyCommand connection pipe: [31,32]
socket_callback_connected: Socket connection callback: 1 (0)
ssh_connect: Socket connecting, now waiting for the callbacks to work
ssh_socket_exception_callback: Socket exception callback: 1 (0)
ssh_socket_exception_callback: Socket error: disconnected
ssh_connect: current state : 9
Socket error: disconnected

ssh2 works just fine:

blink> ssh2 -vvvv lappy
SSHSession:DEBUG:Connecting to 100.109.50.105 [100.109.50.105] port 22.
Connected to 100.109.50.105
SSHSession:DEBUG:Server host key: RSA D7dQBrT+DxVfZllInozDU5DsESw= 
SSHSession:DEBUG:Authenticating as 'britt'.
SSHSession:DEBUG:Attempting authentication with publickey.
SSHSession:DEBUG:Authentication failed
SSHSession:DEBUG:Could not match user and password.
SSHSession:DEBUG:Attempting interactive authentication.
Password:

Thanks for your awesome work! Sending a hermetically sealed hug.

bs commented 4 years ago

Just closing the loop here. It seems that installing mosh with the —head flag on Homebrew solved for this.

carloscabanero commented 8 months ago

Closing.