SSHログインには15秒かかります

SSHログインには15秒かかります

SSHログインには15秒かかります

私は2つのデバイスを手に入れました:

  • Windows 用 WSL 実行中: OpenSSH_7.6p1 Ubuntu-4ubuntu0.5、OpenSSL 1.0.2n 2017 年 12 月 7 日
  • Raspbian 実行中: OpenSSH_7.9p1 Raspbian-10+deb10u2、OpenSSL 1.1.1d 2019 年 9 月 10 日

そして CentOS 8 サーバー。

最初のもの (WSL) では、パスワードまたは公開キーを使用してサーバーにログインするのに 15 秒かかります。Raspbian は即時です。両方のデバイスから接続するには IP を使用します。

サーバーの ssh デーモン ログを debug3 に設定しましたが、2 つのログインの間に大きな違いは見られませんでしたが、ここでは 15 秒の遅延が見られます。

Oct 17 09:13:20 localhost sshd[2080]: debug3: userauth_finish: failure partial=0 next methods="publickey,gssapi-keyex,gssapi-with-mic,password" [preauth]
Oct 17 09:13:20 localhost sshd[2080]: debug3: send packet: type 51 [preauth]
Oct 17 09:13:20 localhost sshd[1979]: debug2: channel 0: rcvd adjust 50867
Oct 17 09:13:36 localhost sshd[2080]: debug3: receive packet: type 50 [preauth]
Oct 17 09:13:36 localhost sshd[2080]: debug1: userauth-request for user marco service ssh-connection method publickey [preauth]

何を探せばいいのか、何か手がかりはありますか?

これはssh -vvvの出力です。タイムスタンプを追加しました。

[2021-10-21 19:53:13] debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
[2021-10-21 19:53:13] debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
[2021-10-21 19:53:13] debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
[2021-10-21 19:53:13] debug3: authmethod_lookup gssapi-with-mic
[2021-10-21 19:53:13] debug3: remaining preferred: publickey,keyboard-interactive,password
[2021-10-21 19:53:13] debug3: authmethod_is_enabled gssapi-with-mic
[2021-10-21 19:53:13] debug1: Next authentication method: gssapi-with-mic
[2021-10-21 19:53:22] debug1: Unspecified GSS failure.  Minor code may provide more information
[2021-10-21 19:53:22] No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
[2021-10-21 19:53:22] 
[2021-10-21 19:53:22] 
[2021-10-21 19:53:33] debug1: Unspecified GSS failure.  Minor code may provide more information
[2021-10-21 19:53:33] No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
[2021-10-21 19:53:33] 
[2021-10-21 19:53:33] 
[2021-10-21 19:53:33] debug2: we did not send a packet, disable method
[2021-10-21 19:53:33] debug3: authmethod_lookup publickey
[2021-10-21 19:53:33] debug3: remaining preferred: keyboard-interactive,password
[2021-10-21 19:53:33] debug3: authmethod_is_enabled publickey
[2021-10-21 19:53:33] debug1: Next authentication method: publickey
[2021-10-21 19:53:33] debug1: Offering public key: /home/marco/.ssh/id_rsa RSA SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[2021-10-21 19:53:33] debug3: send packet: type 50
[2021-10-21 19:53:34] debug2: we sent a publickey packet, wait for reply
[2021-10-21 19:53:34] debug3: receive packet: type 51
[2021-10-21 19:53:34] debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
[2021-10-21 19:53:34] debug1: Trying private key: /home/marco/.ssh/id_dsa
[2021-10-21 19:53:34] debug3: no such identity: /home/marco/.ssh/id_dsa: No such file or directory
[2021-10-21 19:53:34] debug1: Trying private key: /home/marco/.ssh/id_ecdsa
[2021-10-21 19:53:34] debug3: no such identity: /home/marco/.ssh/id_ecdsa: No such file or directory
[2021-10-21 19:53:34] debug1: Trying private key: /home/marco/.ssh/id_ecdsa_sk
[2021-10-21 19:53:34] debug3: no such identity: /home/marco/.ssh/id_ecdsa_sk: No such file or directory
[2021-10-21 19:53:34] debug1: Trying private key: /home/marco/.ssh/id_ed25519
[2021-10-21 19:53:34] debug3: no such identity: /home/marco/.ssh/id_ed25519: No such file or directory
[2021-10-21 19:53:34] debug1: Trying private key: /home/marco/.ssh/id_ed25519_sk
[2021-10-21 19:53:34] debug3: no such identity: /home/marco/.ssh/id_ed25519_sk: No such file or directory
[2021-10-21 19:53:34] debug1: Trying private key: /home/marco/.ssh/id_xmss
[2021-10-21 19:53:34] debug3: no such identity: /home/marco/.ssh/id_xmss: No such file or directory
[2021-10-21 19:53:34] debug2: we did not send a packet, disable method
[2021-10-21 19:53:34] debug3: authmethod_lookup password
[2021-10-21 19:53:34] debug3: remaining preferred: ,password
[2021-10-21 19:53:34] debug3: authmethod_is_enabled password
[2021-10-21 19:53:34] debug1: Next authentication method: password

答え1

GSSAPIAuthentication を無効にしてみてください。WSLsshd_configのファイルを編集し、 から に変更しGSSAPIAuthenticationます。yesno

sudo nano /etc/ssh/sshd_config

変更を保存し、SSH デーモンを再起動します。

sudo systemctl restart sshd

ソース: テックグリンプス

関連情報