0
0

EVE-NGのCiscoIOLルータへのssh接続のRSA暗号鍵の保存

Posted at

RSAキーはデバイスのNVRAMに保存され、configファイルの一部として直接表示されることはありません。EVE-NGでWipe Nodeを実施すると、消えてしまうので、config中に埋め込もうとしましたが、Key pair import failed.のエラーで出てしまい、断念。結果簡単な技で実現出来ました。

(config)#hostname R1
(config)#ip domain-name cisco.com
(config)#username USER password 0 PASS
(config)#ip ssh version 2
(config)#line vty 0 4
(config-line)#login local
(config-line)#transport input telnet ssh

(config)# crypto key generate rsa
How many bits in the modulus [512]:1024

#show crypto key mypubkey rsa
% Key pair was generated at: 13:56:00 JST Aug 4 2024
Key name: R1.cisco.com
Key type: RSA KEYS
Storage Device: not specified
Usage: General Purpose Key
Key is not exportable.
Key Data:
30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00A4C0EB
3C032A72 6DD6AFF2 7F9186CB F793FA67 5B41ABF9 B9AA8379 161DFDAF 98EE845F
455A1D57 0AD26075 DBDA9E18 2498F7E1 D953107E D45AE082 2D99AB62 C0531DAA
E2BB9B83 0288F66F D3A8C20B 48461127 6EA7C95C 49560872 54E84913 91D1D820
6B9EE580 0CA22865 F016BDF2 BFA6BD5B 208BA046 8D7A9089 DB4CF54E 17020301
0001
% Key pair was generated at: 13:56:00 JST Aug 4 2024
Key name: R1.cisco.com.server
Key type: RSA KEYS
Temporary key
Usage: Encryption Key
Key is not exportable.
Key Data:
307C300D 06092A86 4886F70D 01010105 00036B00 30680261 00B53EB3 A4AEE9AE
7DF7FA8B E2970E5A 4E28D297 1442A6D8 113A3880 AD36A726 38DC8D91 8C87B88B
1DE7EB0B F084DAEC A5E89C95 0FA112A7 06AF9A62 FB569F89 49758E58 9D20A7ED
B5CB2EDB 0869F8AA 20943326 3C9E9F7A 2A3B8702 2642ADA4 59020301 0001

(config)#crypto key import rsa mypubkey pem terminal
% Enter PEM-formatted public General Purpose key or certificate.
% End with a blank line or "quit" on a line by itself.

Enter the base 64 encoded RSA key.
Paste the key in base 64 encoding and terminate with a "quit" or "end" on a line by itself:
30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00A18A21
E8A4C89E 73BB1C5E 80215FF2 0C235EEB 806D0BE8 2B057E5C AD513110 4D63F036
0D2F3FCD 454B57A4 1D306612 51AB89B6 013941C0 8BCCCBB5 4ACCE192 358CFCBE
62D39455 1D430074 E9C12107 34D34FA1 F5F64EF5 E4E5CBC0 8A9B1DD0 D26173E3
92D2F04D 018E8ED0 137FABE1 D78A1C2A 475F66ED 1736F1A7 E7BD8954 F7020301
0001
quit
% Key pair import failed
→どうしてもこのエラーが発生してしまいました。

試しに、Startup-configsの最後に、追加した所、Wipe Nodeしても、大丈夫になりました。

!
crypto key generate rsa modulus 1024
end

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0