はじめに
私は Windows11 標準の OpenSSH を削除し、github 版の OpenSSH を使用しています。winget でアップデート出来るので、最新版への追従も簡単です。
何気なく Windows11 の Terminal から ssh で LOLIPOP! にログインしようとした所、次のような状態になりました。
C:\Users\ikeda>ssh lolipop
[nnmm.oo-hiro20180901@spdnnn ~]$ lConnection to ssh.lolipop.jp closed by remote host.
Connection to ssh.lolipop.jp closed.
C:\Users\ikeda>
ls コマンドを入力しようと 'l' を入力した瞬間に 'Connection closed by remote host.' と接続が切断されてしまいました。
このままでは LOLIPOP! の ssh が使用できなくなる為、この現象の原因と対策について調べてみました。
現象
状況は以下の通りです。LOLIPOP! への ssh 接続を試すと、
- Windows11 Terminal から ssh の login までは正常に出来て、プロンプトが表示される。
- 1文字を入力した瞬間に 'Connection to ssh.lolipop.jp closed by remote host.' と表示されて接続が切断される。
- Windows11 Terminal (cmd) を PowerShell 7 に変更しても切断される。
- WSL2 Ubuntu 22.04 LTS の ssh では問題なく接続できる。
- WinSCP では問題なく接続できる。
という事で、Windows11 の cmd 及び PowerShell から起動される ssh に限定された現象でした。
原因と対策
正常に動作する Ubuntu 22.04 LTS と接続が切断される Windows11 の ssh のバージョンを比較しました。
Ubuntu 22.04 LTS :
$ ssh -V
OpenSSH_8.9p1 Ubuntu-3ubuntu0.6, OpenSSL 3.0.2 15 Mar 2022
Windows11 Pro :
> ssh -V
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
Windows11 の OpenSSH は github 版を winget でインストールしていますので、Ubuntu 22.04 LTS よりも新しい版がインストールされています。
なんとなく新しいバージョンの機能による影響かと推測して調べると、以下のページを見つけました。
New features
新機能
ssh(1): add keystroke timing obfuscation to the client. This attempts
to hide inter-keystroke timings by sending interactive traffic at
fixed intervals (default: every 20ms) when there is only a small
amount of data being sent. It also sends fake "chaff" keystrokes for
a random interval after the last real keystroke. These are
controlled by a new ssh_config ObscureKeystrokeTiming keyword.ssh(1): キーストロークのタイミングの難読化をクライアントに追加する.
https://www.unixuser.org/~haruyama/blog/post/20231004.html
少ない量のデータが送られる場合にのみ, 固定した間隔
(デフォルト: 20ms ごと) でインタラクティブなトラフィック を送ることで,
キーストローク間のタイミングを隠すことを試みる. また, 最後の本物の
キーストロークの後にランダムな間隔で 偽の "chaff" キーストロークも
送る. これらは 新しい ssh_config の ObscureKeystrokeTiming 設定項目で
制御される.
という事で、OpenSSH 9.5 より追加された「キーストロークのタイミングの難読化をクライアントに追加する」という新機能により、20 msec ごとにトラフィックを発生させる事が悪影響を及ぼし、1文字を入力した後に接続が切断されていました。
LOLIPOP! の OpenSSH サーバーで Client が OpenSSH 9.5 以降で発生します。このようなオプションの初期条件は安全側に振るでしょうから、OpenSSH というソフトウェアでは有効状態にすると思います。
回避方法
ObscureKeystrokeTiming option を no にする必要があります。以下 ~/.ssh/config のサンプルです。
Host lolipop
ObscureKeystrokeTiming no
HostKeyAlgorithms +ssh-rsa
UpdateHostKeys no
Hostname ssh.lolipop.jp
User nnmm.oo-hiro20180901
Port 2222
ちなみに、OpenSSH のバージョンを調べると
- LOLIPOP! ... 7.4p1 : 異常発生
- Synology DS218plus ssh ... 8.2p1 : 問題なし
Client が OpenSSH 9.5 未満の場合も問題ありません。
補足1 : log の確認 (20240117 追記)
エラーが発生する状況で ssh -vvv で log を採取しました。一部を抜き出しました。
- 3行目 で remote software version として sshr が返ってきています。
- 5行目に 'kex_ext_info_chech_ver: ping@openssh.com=<0>' が出力されています。
- 7行目に 'obfuscate_keystroke_timing: starting:' が出力されています。
- 8行目の先頭の 'l' は、'ls' を入力しようとした最初の文字です。
LOLIPOP! の OpenSSH server の正確な version は不明ですが
- client が OpenSSH 7.4p1
- HostKeyAlgorithms +ssh-rsa を設定しないとメッセージが表示される
この二つのことから、7.4p1 ではないかと推測しています。
...(snip)...
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.5
debug1: Remote protocol version 2.0, remote software version sshr
...(snip)...
debug1: kex_ext_info_check_ver: ping@openssh.com=<0>
...(snip)...
[nnnn.mm-hiro20180901@bbbaaa ~]$ debug3: obfuscate_keystroke_timing: starting: interval ~20ms
ldebug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 [session] r0 i0/0 o0/0 e[write]/0 fd 4/5/6 sock -1 cc -1 io 0x01/0x00)
debug3: Successfully set console output code page from 65001 to 65001
debug3: Successfully set console input code page from 65001 to 932
Connection to ssh.lolipop.jp closed by remote host.
Connection to ssh.lolipop.jp closed.
Transferred: sent 2920, received 2644 bytes, in 1.7 seconds
Bytes per second: sent 1686.9, received 1527.4
debug1: Exit status -1
少々長いですが log の全文を載せておきます。
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
debug1: Reading configuration data C:\\Users\\hiro/.ssh/config
debug3: C:\\Users\\hiro/.ssh/config line 1: Including file C:\\Users\\hiro/.ssh/conf.d/NAS.config depth 0
debug1: Reading configuration data C:\\Users\\hiro/.ssh/conf.d/NAS.config
debug3: C:\\Users\\hiro/.ssh/config line 1: Including file C:\\Users\\hiro/.ssh/conf.d/abcdef.config depth 0
debug1: Reading configuration data C:\\Users\\hiro/.ssh/conf.d/abcdef.config
debug3: C:\\Users\\hiro/.ssh/config line 1: Including file C:\\Users\\hiro/.ssh/conf.d/lolipop.config depth 0
debug1: Reading configuration data C:\\Users\\hiro/.ssh/conf.d/lolipop.config
debug1: C:\\Users\\hiro/.ssh/conf.d/lolipop.config line 1: Applying options for lolipop
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\hiro/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\hiro/.ssh/known_hosts2'
debug2: resolving "ssh.lolipop.jp" port 2222
debug3: resolve_host: lookup ssh.lolipop.jp:2222
debug3: ssh_connect_direct: entering
debug1: Connecting to ssh.lolipop.jp [aaa.bbb.ccc.ddd] port 2222.
debug1: Connection established.
debug3: Failed to open file:C:/Users/hiro/.ssh/id_rsa error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_rsa.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_rsa error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_rsa type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_rsa-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_rsa-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_rsa-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_rsa-cert type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ecdsa error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ecdsa type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ecdsa-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ecdsa-cert type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa_sk error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa_sk.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ecdsa_sk error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ecdsa_sk type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa_sk-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ecdsa_sk-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ecdsa_sk-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ecdsa_sk-cert type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519 error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ed25519 error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ed25519 type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ed25519-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ed25519-cert type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519_sk error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519_sk.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ed25519_sk error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ed25519_sk type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519_sk-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_ed25519_sk-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_ed25519_sk-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_ed25519_sk-cert type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_xmss error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_xmss.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_xmss error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_xmss type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_xmss-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_xmss-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_xmss-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_xmss-cert type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_dsa error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_dsa.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_dsa error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_dsa type -1
debug3: Failed to open file:C:/Users/hiro/.ssh/id_dsa-cert error:2
debug3: Failed to open file:C:/Users/hiro/.ssh/id_dsa-cert.pub error:2
debug3: failed to open file:C:/Users/hiro/.ssh/id_dsa-cert error:2
debug1: identity file C:\\Users\\hiro/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.5
debug1: Remote protocol version 2.0, remote software version sshr
debug1: compat_banner: no match: sshr
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to ssh.lolipop.jp:2222 as 'nnnn.mm-hiro20180901'
debug3: put_host_port: [ssh.lolipop.jp]:2222
debug3: record_hostkey: found key type RSA in file C:\\Users\\hiro/.ssh/known_hosts:4
debug3: load_hostkeys_file: loaded 1 keys from [ssh.lolipop.jp]:2222
debug3: Failed to open file:C:/Users/hiro/.ssh/known_hosts2 error:2
debug1: load_hostkeys: fopen C:\\Users\\hiro/.ssh/known_hosts2: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: prefer hostkeyalgs: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,kex-strict-c-v00@openssh.com
debug2: host key algorithms: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,kex-strict-s-v00@openssh.com
debug2: host key algorithms: rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss
debug2: ciphers ctos: aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: MACs ctos: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-sha1-96
debug2: MACs stoc: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-sha1-96
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug3: kex_choose_conf: will use strict KEX ordering
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
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
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:1Rt0rvYV+xZGCMAzm6BKjqAIPWXYYDX0bYK5CikAvCE
debug3: put_host_port: [aaa.bbb.ccc.ddd]:2222
debug3: put_host_port: [ssh.lolipop.jp]:2222
debug3: record_hostkey: found key type RSA in file C:\\Users\\hiro/.ssh/known_hosts:4
debug3: load_hostkeys_file: loaded 1 keys from [ssh.lolipop.jp]:2222
debug3: Failed to open file:C:/Users/hiro/.ssh/known_hosts2 error:2
debug1: load_hostkeys: fopen C:\\Users\\hiro/.ssh/known_hosts2: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host '[ssh.lolipop.jp]:2222' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\hiro/.ssh/known_hosts:4
debug3: send packet: type 21
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: ssh_get_authentication_socket_path: path '\\\\.\\pipe\\openssh-ssh-agent'
debug2: get_agent_identities: ssh_agent_bind_hostkey: invalid format
debug1: get_agent_identities: agent returned 4 keys
debug1: Will attempt key: user@abcde.fgh ED25519 SHA256:+abcdefghijklmnopqrstuvwxyz0123456789abcdefg agent
debug1: Will attempt key: user@hijkl.mno ED25519 SHA256:0123456789abcdefghijklmnopqrstuvwxyz0123456 agent
debug1: Will attempt key: user1 ED25519 SHA256:56789abcdefghijklmnopqrstuvwxyz0123456789ab agent
debug1: Will attempt key: user2 ED25519 SHA256:89abcdefghijklmnopqrstuvwxyz0123456789abcde agent
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_ed25519_sk
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_xmss
debug1: Will attempt key: C:\\Users\\hiro/.ssh/id_dsa
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss>
debug1: kex_ext_info_check_ver: ping@openssh.com=<0>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: user@abcde.fgh ED25519 SHA256:+abcdefghijklmnopqrstuvwxyz0123456789abcdefg agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: user@abcde.fgh ED25519 SHA256:+abcdefghijklmnopqrstuvwxyz0123456789abcdefg agent
debug3: sign_and_send_pubkey: using publickey with ED25519 SHA256:+abcdefghijklmnopqrstuvwxyz0123456789abcdefg
debug3: sign_and_send_pubkey: signing using ssh-ed25519 SHA256:+abcdefghijklmnopqrstuvwxyz0123456789abcdefg
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: user1 ED25519 SHA256:0123456789abcdefghijklmnopqrstuvwxyz0123456 agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: user1 ED25519 SHA256:0123456789abcdefghijklmnopqrstuvwxyz0123456 agent
debug3: sign_and_send_pubkey: using publickey with ED25519 SHA256:0123456789abcdefghijklmnopqrstuvwxyz0123456
debug3: sign_and_send_pubkey: signing using ssh-ed25519 SHA256:0123456789abcdefghijklmnopqrstuvwxyz0123456
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: user2 ED25519 SHA256:56789abcdefghijklmnopqrstuvwxyz0123456789ab agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: user2 ED25519 SHA256:56789abcdefghijklmnopqrstuvwxyz0123456789ab agent
debug3: sign_and_send_pubkey: using publickey with ED25519 SHA256:56789abcdefghijklmnopqrstuvwxyz0123456789ab
debug3: sign_and_send_pubkey: signing using ssh-ed25519 SHA256:56789abcdefghijklmnopqrstuvwxyz0123456789ab
debug3: send packet: type 50
debug3: receive packet: type 52
Authenticated to ssh.lolipop.jp ([aaa.bbb.ccc.ddd]:2222) using "publickey".
debug2: fd 5 setting O_NONBLOCK
debug2: fd 6 setting O_NONBLOCK
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Entering interactive session.
debug1: pledge: network
debug3: client_repledge: enter
debug1: ENABLE_VIRTUAL_TERMINAL_INPUT is supported. Reading the VTSequence from console
debug3: This windows OS supports conpty
debug1: ENABLE_VIRTUAL_TERMINAL_PROCESSING is supported. Console supports the ansi parsing
debug3: Successfully set console output code page from:65001 to 65001
debug3: Successfully set console input code page from:932 to 65001
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug3: client_repledge: enter
debug1: pledge: fork
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
[nnnn.mm-hiro20180901@bbbaaa ~]$ debug3: obfuscate_keystroke_timing: starting: interval ~20ms
ldebug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 [session] r0 i0/0 o0/0 e[write]/0 fd 4/5/6 sock -1 cc -1 io 0x01/0x00)
debug3: Successfully set console output code page from 65001 to 65001
debug3: Successfully set console input code page from 65001 to 932
Connection to ssh.lolipop.jp closed by remote host.
Connection to ssh.lolipop.jp closed.
Transferred: sent 2920, received 2644 bytes, in 1.7 seconds
Bytes per second: sent 1686.9, received 1527.4
debug1: Exit status -1
補足2 : sshr について (20240117 追記)
sshr について X (twitter) で教えて頂きました。
sshr は ssh proxy server です。
remote software version に 'sshr' が表示される事は問題なく、'kex_ext_info_check_ver: ping@openssh.com=<0>' なのに ObscureKeystrokeTiming に対応できていないので、proxy の sshr の不具合ではないでしょうか。
そういえば、ssh の proxy に関しては過去にもトラブルがありました。参考まで。
まとめ
Windows11 の ssh を github 版 OpenSSH 9.5p1 に更新した後に、LOLIPOP! レンタルサーバーへ ssh 接続する際に異常が発生しました。 login は出来ますが、1文字入力するだけで接続が切断される現象です。
- 原因は、OpenSSH 9.5 で追加された「キーストロークのタイミングの難読化をクライアントに追加する」という機能が働いたためです。
- ssh_config に 'ObscureKeystrokeTiming no' を追加すると、上記の機能が無効になります。
- OpenSSH 9.5 未満のクライアントでは発生しません。
- log を確認すると、LOLIPOP! レンタルサーバーの OpenSSH server が remote software version に 'sshr' を返します。
- sshr は ssh の proxy server ですので、実際の sshd が 'ObscureKeystrokeTiming' に対応していないのに、sshr から対応しているという応答がある為に、ObscureKeystrokeTiming を使おうとして失敗して接続が切断されていました。
LOLIPOP! レンタルサーバーへの接続に OpenSSH 9.5 以上の version を使用する場合にはご注意下さい。
今回のアイキャッチ画像
日没に向かって歩く人を SDXL で生成しました。日本海側で育ったので、日没は海に沈む太陽です。現在の住まいは太平洋側なので、海から昇る朝日は一度だけ見ました。
Amazon で販売されている 15.6 in. FullHD のモバイルモニターが気になっています。デュアルモニターの便利さは実感していますのでポチりそうになりましたが、置き場所が無いので我慢です。
コメント