Ssh
如何驗證 Dropbear RSA 主機密鑰的指紋?
當我第一次連接到我的 Dropbear SSH 伺服器時,我收到以下消息:
me@laptop:~$ ssh me@server The authenticity of host 'server' can't be established. RSA key fingerprint is SHA256:NycCxoRiiSAGA7Rvlnuf1gU8pazIpXJKZ3ukdivyam8. Are you sure you want to continue connecting (yes/no)?
為了確保這是正確的伺服器,我想將該消息中的指定指紋與伺服器的真實指紋進行比較。如何找出伺服器的 RSA 主機密鑰指紋?
在伺服器上找到主機密鑰文件:
me@server:~$ ls /etc/dropbear/ authorized_keys config dropbear_rsa_host_key
用於
dropbearkey
獲取該主機密鑰的公鑰部分和指紋:me@server:~$ sudo dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key Public key portion is: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCk/0IEQhlDHfe3jd1MafWLEsTMFADflBWiODik6CnHXmXUrp1XmQ0fo16ffRxupnIuieU44VZkfCP8MX+WIVMRc/+UOJAox7U+v7B3T9H0a4ZeB48NyPdUCZ9MVSbk+kWmHn+UoXtPdMZ/htQ13XHJLHU8h2I+4dTUs1TYWeW4b8LppRexUJPCjdc9YxmkwI+ctHs6I1oguqSy6IP+aAlK0+QkNrG8HeFe1Nmg2iL5SuYfJCIgxJylK+s6KVMpzVPv7VNX3bSt1NJvf2etowR7kzTZs+uCJyzdILO2p5yAo9V80/zzwyqV+exPHUjD/SE9tYjEBkzKKNo215xQvAzV me@server Fingerprint: sha1!! 41:b0:5e:af:8c:4d:2b:ae:fd:75:7d:f1:d5:35:e1:49:14:2e:08:12
雜湊算法會有所不同,具體取決於您的版本。將公鑰部分導入
ssh-keygen
以使用特定的雜湊算法:me@server:~$ sudo dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | ssh-keygen -l -f - -E sha256 2048 SHA256:NycCxoRiiSAGA7Rvlnuf1gU8pazIpXJKZ3ukdivyam8 me@server (RSA) me@server:~$ sudo dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | ssh-keygen -l -f - -E sha1 2048 SHA1:QbBer4xNK679dX3x1TahSRMuLBI me@server (RSA) me@server:~$ sudo dropbearkey -y -f /etc/dropbear/dropbear_rsa_host_key | ssh-keygen -l -f - -E md5 2048 MD5:bb:36:37:3e:ae:36:69:d3:6d:63:b8:a3:97:c3:78:60 me@server (RSA)