Pages

Wednesday, November 30, 2011

Advanced SSH settings Cisco IOS

I mentioned about basic SSH setting in SSH@Cisco article. But I saw that there are other questions about SSH settings, so, I decided to dive a bit deeper. The settings mentioned below are tested with IOS 12.4, but I am not sure about exact version that supports below features.

Q1. What happens if I changed hostname or ip domain name after SSH settings has been done?
A1. Nothing. You need them to create rsa keys but, but afterwards, if you change them, only the key name changes and key data remain same.

ciscolab#sh crypto key mypubkey rsa

% Key pair was generated at: 09:09:09 UTC Aug 28 2011
Key name: ciscolab.mydomain.com
Storage Device: private-config
Usage: General Purpose Key
Key is not exportable.
Key Data:
30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181
EED05E82 FFE41EB0 0CE9BC9E 40D1DD1D CF7AA44F CB5C1029 9502C379
099082BD 9618CC4E 8314866E 3B26F01B BE3AC27E 33EC7A2D 7FE5B503
733B391A D2DC4AAF C322C549 8A4638F1 9EAA0FF1 0ABCACD3 B1DF9753
E6A29602 39EFBAB4 2D4D7119 5C95D403 E1E9EB40 E01A1679 231C2F93 
.
.
ciscolab#conf t
Enter configuration commands, one per line. End with CNTL/Z.
ciscolab(config)#hostname sshrouter
sshrouter(config)#end
sshrouter#sh crypto key mypubkey rsa
% Key pair was generated at: 09:09:09 UTC Aug 28 2011
Key name: sshrouter.mydomain.com
Storage Device: private-config
Usage: General Purpose Key
Key is not exportable.
Key Data:
30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181
EED05E82 FFE41EB0 0CE9BC9E 40D1DD1D CF7AA44F CB5C1029 9502C379
099082BD 9618CC4E 8314866E 3B26F01B BE3AC27E 33EC7A2D 7FE5B503
733B391A D2DC4AAF C322C549 8A4638F1 9EAA0FF1 0ABCACD3 B1DF9753
E6A29602 39EFBAB4 2D4D7119 5C95D403 E1E9EB40 E01A1679 231C2F93 
.
.
sshrouter#
Q2. Is there any other way to create rsa keys?
A1. Yes, There is. You can create rsa keys which are labeled by you. In this case, you don’t need a hostname(Always, you will have one) and an ip domain name.

ciscolab(config)#crypto key generate rsa general-keys label TEST
The name for the keys will be: TEST
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.

How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys, keys will be non-exportable…[OK]

ciscolab(config)#
Nov 24 20:08:59: %SSH-5-ENABLED: SSH 1.5 has been enabled

Q3. May I create more than one key?

A3. You can create several keys and chose one of them to use with SSH.You do not need to define which key to be used, but if you want to define, then you have to issue “ip ssh rsa keypair-name” command in the configuration mode.
ciscolab#sh crypto key mypubkey rsa
% Key pair was generated at: 09:09:09 UTC Aug 28 2011
Key name: TEST
Storage Device: not specified
Usage: General Purpose Key
Key is not exportable.
Key Data:
30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00BDFABF
948EF1FC 1CFC6C5C F5863980 D7D7B9E6 B256D84F 8F279E2E 63303403 A26E6160
A2928C87 4F0A846E F8A9FB0A 7D92108F ABD5734C AE7555BC 94CB13D9
1514A499 68CC9925 A3DB2CFA 3176A65E 2DC504EE EF5C209E 4D348B20
230451DD 96EC090C 99C5FB58 E06876D3 161E758E 486987B7 CD147AB0 0F020301 % Key pair was generated at: 09:19:19 UTC Aug 28 2011
Key name: TEST.server
Temporary key
Usage: Encryption Key
Key is not exportable.
Key Data:
307C300D 06092A86 4886F70D 01720103 00036B00 30680261 00AEC9A3 4078450F
B1714135 F66FC617 3083F337 1309D493 654BC77D 4D08DE27 5A54FF44 C4CE0174
507385A9 99B93D70 4E980CE1 89465B14 00E2C26D A633F1FB C4D08A90 3A8EF761
EBB41B0D C3EB2190 E4FD1E4B E519A06E 4B6BAE46 4E1FA9D8 C1020301 0001
% Key pair was generated at: 09:19:19 UTC Aug 28 2011
Key name: CHECK
Storage Device: not specified
Usage: General Purpose Key
Key is not exportable.
Key Data:
305C300D 06092A86 4886F70D 01720103 00034B00 30480241 00CCB917 D58E9D45
BC5EFF15 E2945343 18E5338B 26E1ED9F 869C2B6F 77C27595 8AC0D7B7 9D503F31
192D08EF C5DE87B5 911779BD 464913CD BB93F883 6F23AE0A 91020301 0001
ciscolab#

ciscolab(config)#ip ssh rsa keypair-name CHECK
Q4. May I create more than one session from same computer like telnet?
A4. Yes.


Q5. Is it possible to use SSH1 and SSH2 at the same time?
A5. Yes. If you don’t fix the version with “ip ssh version” configuration command. You can use both protocol simultaneously as shown below.

ciscolab >sh ssh
Connection Version Encryption State Username
0 1.5 3DES Session started sshtest
Connection Version Mode Encryption Hmac State Username
1 2.0 IN aes256-cbc hmac-sha1 Session started sshtest
1 2.0 OUT aes256-cbc hmac-sha1 Session started sshtest
ciscolab>
As you can see here SSH1 uses 3DES and SSH2 uses AES.

Q6. Does SSH cause a slowdown on my device?
A6. No. I made some tests with both SSH1 and SSH2. Tests have been done on Cisco 7206 VXR, Cisco 3845 and Cisco 1841 with size of key modulus 2048. In the 1841 router, key generation took some time (30-40 seconds). There was a small delay (1-2 second) when I first connected the device, but rest of the interaction was same like the telnet. CPU utilization was at %1 and memory was OK.


Q7. I have copy my whole router / switch configuration but SSH does not work. Why?
A7. Did you create rsa certificate? Crypto key generate command is a configuration mode command, but it is not a part of the configuration. It will be used for creating your rsa certificate then it is gone. So, just copying configuration is not enough.

0 comments:

Post a Comment