簡介
本文檔介紹修復SSH主機金鑰驗證失敗問題的過程。
背景
在升級DNACenter映像後,當使用者嘗試透過SSH連線到DNACenter的網關時,會發生此錯誤。到目前為止,此問題只出現在macOS使用者中。
說明
將DNACenter升級到新映像後,本地使用者的SSH金鑰登錄檔檔案維護用於連線到先前DNACenter的梯形內部版本的SSH金鑰。錯誤如下:
MPAVLOVI-M-902T:~ mpavlovi$ ssh grapevine@172.16.21.86 -p 2222
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:+dnn+NRIXTDMmgpUNbeqdjDQscabBBWmC35F01ZFnLs.
Please contact your system administrator.
Add correct host key in /Users/mpavlovi/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/mpavlovi/.ssh/known_hosts:16
ECDSA host key for [172.16.21.86]:2222 has changed and you have requested strict checking.
Host key verification failed.
MPAVLOVI-M-902T:~ mpavlovi$
解決方案
要解決此問題,需要從本地目錄~/.ssh/處的登錄檔檔案known_host中刪除之前的梯形SSH金鑰。
要刪除以前的SSH金鑰,請轉到terminal並使用您選擇的文本編輯器打開檔案:
MPAVLOVI-M-902T:~ mpavlovi$ vim ~/.ssh/known_hosts
繼續刪除其中包含DNAC輸入IP地址的行
[10.197.218.12]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKkToWAUheuqt876tDOrWwDSH5HbL0TLMw5MAsOsLqCnb3jRn5oxIJn2yECB1HPamglO/m79o2W8mAGAjypyFkw=
[172.16.21.86]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKz4ObQLQE7VEHZLOYL0t6k8aqbvFGIFDXsVaTguchsSNyGScFa6PLJKCZj/S7YIultUTYH94NZv4pCl509svvk=
注意:修改其他金鑰可能會影響您對其他裝置/站點的SSH訪問。僅刪除所需的SSH金鑰。
[10.197.218.12]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKkToWAUheuqt876tDOrWwDSH5HbL0TLMw5MAsOsLqCnb3jRn5oxIJn2yECB1HPamglO/m79o2W8mAGAjypyFkw=
在文本編輯器中儲存更改,並重試到SSH到DNACenter grapevine。提示時輸入「yes」字樣。
MPAVLOVI-M-902T:~ mpavlovi$ ssh grapevine@172.16.21.86 -p 2222
The authenticity of host '[172.16.21.86]:2222 ([172.16.21.86]:2222)' can't be established.
ECDSA key fingerprint is SHA256:+dnn+NRIXTDMmgpUNbeqdjDQscabBBWmC35F01ZFnLs.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[172.16.21.86]:2222' (ECDSA) to the list of known hosts.
使用葛雷普韋認證密碼。
grapevine@172.16.21.86's password:
Welcome to the Cisco APIC-EM Appliance - Powered by Grapevine
System information as of Wed Jul 19 22:20:17 UTC 2017
System load: 1.02 Users logged in: 1
Usage of /: 11.7% of 365.80GB IP address for eth0: 12.99.1.2
Memory usage: 41% IP address for eth1: 172.16.21.86
Swap usage: 0% IP address for grape-br0: 169.254.0.1
Processes: 695
APIC-EM Version: 2.0.0.3757
Grapevine Version: 2.0.0.3757.dev1065-ge50d0c2
Last login: Wed Jul 19 21:45:22 2017 from 10.41.49.41
(grapevine)
[Wed Jul 19 22:20:18 UTC] grapevine@12.99.1.2 (grapevine-root-1) ~
$