エージェントが鍵で署名しなかったことを認める

エージェントが鍵で署名しなかったことを認める

エージェントが鍵で署名しなかったことを認める

私はcentos6.5(32bit)で作業していますが、ssh-keygenとssh-copy-idを使用してパスワードなしでsshログインを試していますか?完了したステップ:

まず鍵を作りました。

[root@dd ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
8f:48:0b:04:3a:e1:90:f4:9f:de:2a:33:63:ea:a8:82 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
|+o.              |
|+o..             |
|o. ..            |
| . .. .          |
|    .o. S        |
|    .o.o o       |
|.    .o.. .      |
|E  *  .          |
|*oo =.           |
+-----------------+

次に、キーをリモートホストにコピーします。

[root@dd ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub 192.168.1.3
[email protected]'s password: My_Password
Now try logging into the machine, with "ssh '[email protected]'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

その後、ログインしようとしましたが失敗します(キーを使用)。

[root@dd ~]# ssh 192.168.1.3
Agent admitted failure to sign using the key.
[email protected]'s password: 

そして詳細なロギングで:

[root@dd ~]# ssh -v [email protected]
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.1.3 [192.168.1.3] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/identity-cert type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.1.3' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information 
Cannot determine realm for numeric host address

debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address

debug1: Next authentication method: publickey
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
Agent admitted failure to sign using the key.
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
[email protected]'s password: 

ベストアンサー1

あなたは次のような失敗に苦しんでいます。

代理人は署名に鍵を使用しなかったと認めた。

残念ながら、これは診断ではなくメッセージです。これは(少なくとも)2つのタイプの問題を解決することができる。

 

キーがロードされていません。

ほとんどの問題では、これはssh-agentターゲットサーバーのアカウントで許可されているSSHキーをロードしないことを意味します。この場合、指摘したように@网达人の返信この問題に対する解決策は非常に簡単です。キーを追加するだけです。

ssh-add

キーがデフォルトの場所ではない場所にある場合は、次のように通知する必要がありますssh-add

ssh-add /path/to/key

 

エージェントはキーを理解できません。

これはGNOME BUG 754028、Seahorse 3.29.90(安定3.30)で修正2018-09-03にリリース、含まれるUbuntu18.10Fedora 29、そしておそらくRed Hat/CentOS 9)。 3.29.90より前のSeahorse(およびGNOME Keyring)は、新しいキータイプを作成または追加することはできません。ed25519そして生成されたキーssh-keygen -o -a 100(提案どおり)安全安全エンクロージャ指導時間)。

この問題の診断:

  • ssh myserver「Sshエージェントが失敗を認識しました」と失敗します。
  • SSH_AUTH_SOCK= ssh myserver非常にうまく動作
  • 結論:gnome-keyring複雑なキーストロークを処理できません

私はこのエラーの解決策を見つけましたが、どこにも公開されていないようです。コメント私はUbuntuのバグを追加し、ここに入れます。

解決策:ssh-agent次のようなソケットを使用して新しいソケットを起動しますgnome-keyring

ssh-agent -a $SSH_AUTH_SOCK

これにより、新しいインスタンスが起動されるためssh-agent(GNOMEの強力なインスタンスが上書きされます)、キーはありません(seahorseとにかく以前のエージェントに接続しているため)。ssh-add次のように追加する必要がありますキーがロードされていません。上部です。

ログインするたびに実行する必要があります(または起動スクリプトに手動で追加する必要があります)。既存のソケットを保持するには、まず実行してくださいmv $SSH_AUTH_SOCK $SSH_AUTH_SOCK.broken

おすすめ記事