ssh-keyscanはキーを返しません

ssh-keyscanはキーを返しません

以下は私のコンソールの例です。他のコンソールで行ったように、指紋がどこかにあることを確認したいと思います。現在、Linux用のWindowsサブシステムを介してUbuntuを使用しています。鍵を受け取りたいホストのリストがたくさんあります。それらのいくつかは動作し、一部は動作しません。

user@user:/homedir$ ssh-keyscan -H hostname
# hostname:22 SSH-2.0-9.99 sshlib
# hostname:22 SSH-2.0-9.99 sshlib
# hostname:22 SSH-2.0-9.99 sshlib
# hostname:22 SSH-2.0-9.99 sshlib
# hostname:22 SSH-2.0-9.99 sshlib

-vを使用してデバッグログを取得すると、出力は次のようになります。

debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: (no match)
debug1: no match: 9.99 sshlib

成功したキースキャンは次のとおりです。

debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<8192<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
hostname ssh-rsa AAAAB...etc

クライアント(FileZilla)を使用してサーバーに接続すると、成功し、ssh-dss 1024ホストキーが返されます。同じホストキーを取得するためにssh-keyscanを使用したいと思います。

~からUbuntuドキュメント、ssh-keyscanが探す主キータイプはrsaであるため、ユーザーは特定のホストのssh-dssキーを取得するためにdsaを指定する必要があります。

-tタイプ:

         Specifies the type of the key to fetch from the scanned hosts.  The possible values
         are “rsa1” for protocol version 1 and “dsa”, “ecdsa”, “ed25519”, or “rsa” for
         protocol version 2.  Multiple values may be specified by separating them with
         commas.  The default is to fetch “rsa”, “ecdsa”, and “ed25519” keys.

したがって、キーが見つからない場合は、次のように動作します。

ssh-keyscan -t dsa hostname

できることをすべて試したい場合:

ssh-keyscan -T 20 -t dsa, rsa1, rsa, ecdsa, ed25518 hostname

時間がかかる場合があるため、20秒でより長いタイムアウトを指定してください。接続を試みる多くのホストではまだ機能しないため、まだ答えはありません。

ベストアンサー1

おすすめ記事