最初の指紋を入手

最初の指紋を入手

RSA指紋の私の理解は、これが基本的に鍵のハッシュであるということです。

ポート転送の私の理解は次のとおりですman ssh

 -R [bind_address:]port:host:hostport
         Specifies that the given port on the remote (server) host is to
         be forwarded to the given host and port on the local side.  This
         works by allocating a socket to listen to port on the remote
         side, and whenever a connection is made to this port, the connec‐
         tion is forwarded over the secure channel, and a connection is
         made to host port hostport from the local machine.

SSHを使用して転送されたポートに接続するときのRSAキーフィンガープリントのハッシュは何ですか? 複数のシステムで同じRSA認証キーを使用する私が尋ねる理由を説明します。

それとも、例えば、以下の2つの指紋は何ですか?

  1. RSA キーの指紋は 94:21:d2:fc:70:2d:8d:bb:71:30:0f:4d:52:49:01:43 です。
  2. RSA キーの指紋は b2:5b:19:25:91:50:3c:45:73:c7:7e:4f:da:c3:f6:f3 です。

最初の指紋を入手

マシン1

sshtunnel@pi_one:~ $ ssh -R 2222:localhost:22 [email protected]

一般機械

[sshtunnel@devserver ~]$ ssh -p 2222 sshtunnel@localhost
The authenticity of host '[localhost]:2222 ([::1]:2222)' can't be established.
RSA key fingerprint is 94:21:d2:fc:70:2d:8d:bb:71:30:0f:4d:52:49:01:43.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.

2回目の指紋を入手

マシン2

sshtunnel@pi_two:~ $ ssh -R 2222:localhost:22 [email protected]

一般機械

[sshtunnel@devserver ~]$ ssh -p 2222 sshtunnel@localhost
The authenticity of host '[localhost]:2222 ([::1]:2222)' can't be established.
RSA key fingerprint is b2:5b:19:25:91:50:3c:45:73:c7:7e:4f:da:c3:f6:f3.
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
[sshtunnel@devserver ~]$

ベストアンサー1

ホストの公開鍵は次の場所にあります/etc/ssh/ssh_host_*_key.pub

$ ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is 60:6e:7a:10:85:a4:14:f1:37:44:88:17:29:67:b1:e1.
Are you sure you want to continue connecting (yes/no)? ^C

$ ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key
256 60:6e:7a:10:85:a4:14:f1:37:44:88:17:29:67:b1:e1 /etc/ssh/ssh_host_ecdsa_key.pub (ECDSA)

ssh-keygen(秘密鍵の指紋(拡張子なし)を要求しても構いません。.pub自動的にその公開鍵を読みます。)

あなたの場合は言及されたRSAキーであるため、/etc/ssh/ssh_host_rsa_key.pubポート転送を使用するとssh結局接続されるホストになります。

最新バージョンでは、デフォルトssh-keygenの出力はキーのbase64でエンコードされたSHA256ハッシュです。この-E md5オプションを追加すると、16進数でエンコードされたMD5ハッシュが提供されます(ただし、ハッシュタイプを表すプレフィックスがあることに注意してください)。

$ ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key.pub
256 SHA256:4+dfNAIjGq72HL9UeNEpne8J54yj/4wFpi+/4Bv7dhQ root@... (ECDSA)
$ ssh-keygen -Emd5 -l -f /etc/ssh/ssh_host_ecdsa_key.pub
256 MD5:3c:18:e7:9c:ee:e8:6a:38:7d:74:ef:2f:a5:51:ee:1a root@... (ECDSA)

おすすめ記事