以前のバージョンのLinuxは、新しいWindowsインストールでssh id_rsaキーを拒否します。

以前のバージョンのLinuxは、新しいWindowsインストールでssh id_rsaキーを拒否します。

私は長い間古いLinuxサーバー(CentOS 6.5)を維持してきました。 「pub key auth」を使用して ssh 経由で Linux サーバーにアクセスします。

今、私は新しいWindows(win10または11はわからない)ノートブックを購入し、「Git for win 2.33」をインストールし、通常どおり新しいラップトップでsshを試してみると、次のような結果が表示されます。

$  ssh -i ~/.ssh/id_rsa.bridge_to_home -p 5122  -vv shaozr@{ip addr}

OpenSSH_8.8p1, OpenSSL 1.1.1m  14 Dec 2021

debug1: Reading configuration data /etc/ssh/ssh_config

debug2: resolve_canonicalize: hostname 27.115.62.170 is address

debug1: Connecting to 27.115.62.170 [27.115.62.170] port 5122.

debug1: Connection established.

debug1: identity file /c/Users/43141/.ssh/id_rsa.bridge_to_home type -1

debug1: identity file /c/Users/43141/.ssh/id_rsa.bridge_to_home-cert type -1

debug1: Local version string SSH-2.0-OpenSSH_8.8

debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3

debug1: compat_banner: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000002

debug2: fd 4 setting O_NONBLOCK

debug1: Authenticating to 27.115.62.170:5122 as 'shaozr'

debug1: load_hostkeys: fopen /c/Users/43141/.ssh/known_hosts: No such file or directory

debug1: load_hostkeys: fopen /c/Users/43141/.ssh/known_hosts2: No such file or directory

debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: 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

debug2: local client KEXINIT proposal

debug2: KEX algorithms: curve25519-sha256,[email protected],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

debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256

debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc

debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],aes128-cbc,3des-cbc,aes256-cbc,aes192-cbc

debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1

debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1

debug2: compression ctos: none,[email protected],zlib

debug2: compression stoc: none,[email protected],zlib

debug2: languages ctos:

debug2: languages stoc:

debug2: first_kex_follows 0

debug2: reserved 0

debug2: peer server KEXINIT proposal

debug2: KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

debug2: host key algorithms: ssh-rsa,ssh-dss

debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]

debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]

debug2: MACs ctos: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96

debug2: MACs stoc: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96

debug2: compression ctos: none,[email protected]

debug2: compression stoc: none,[email protected]

debug2: languages ctos:

debug2: languages stoc:

debug2: first_kex_follows 0

debug2: reserved 0

debug1: kex: algorithm: diffie-hellman-group-exchange-sha256

debug1: kex: host key algorithm: (no match)

Unable to negotiate with 27.115.62.170 port 5122: no matching host key type found. Their offer: ssh-rsa,ssh-dss

これはとても奇妙です。

古いPCからはまだLinuxにSSHを介して接続でき、新しいラップトップからSSHを介して(よく知られているgit repoプロバイダとして)git cloneを実行できます。

どちらも「ssh OK」のように見えますが、CentOS6.6が「Git for win 2.33」で私のid_rasキーを拒否するのはなぜですか?

ベストアンサー1

OpenSSH 9がインストールされている新しいWindowsシステムで作業中にこの問題が発生しました。 8.somethingでは、OpenSSHチームはデフォルトで古いssh-rsa暗号化アルゴリズムを無効にしたことがわかりました。 (望むよりhttps://www.openssh.com/releasenotes.html)

サーバーがあなたを拒否するわけではありません。これは、新しいクライアントが既存のOpenSSHデーモンssh-rsaを使用しないためです。できる言う。

顧客に再度有効にするように指示できますが、これは回避策です。サーバーでSSHデーモンをアップグレードする必要があります。 ssh-rsaアルゴリズムは安全ではなく、最新のハードウェアで簡単に壊れる可能性があるため、無効になります。

したがって、解決策は、クライアントの$ HOME / .ssh / configにssh設定ファイルを生成し、ここに次のコンテンツを追加することです。

Host HOSTNAME
    HostKeyAlgorithms +ssh-rsa
    PubkeyAcceptedAlgorithms +ssh-rsa

HOSTNAME を接続するホスト名と一致する正規表現に置き換えます。

おすすめ記事