Secure Shell Configuration Guide, Cisco IOS Release 12.2SX: Americas Headquarters
Secure Shell Configuration Guide, Cisco IOS Release 12.2SX: Americas Headquarters
2SX
Americas Headquarters
Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 USA http://www.cisco.com Tel: 408 526-4000 800 553-NETS (6387) Fax: 408 527-0883
CONTENTS
Configuring Secure Shell 1 Finding Feature Information 1 Prerequisites for Configuring SSH 1 Restrictions for Configuring SSH 2 Information About Secure Shell 2 SSH Server 2 SSH Integrated Client 2 RSA Authentication Support 3 How to Configure SSH 3 Configuring an SSH Server 3 Invoking an SSH Client 4 Troubleshooting Tips 5 Configuration Examples for SSH 5 Example SSH on a Cisco 7200 Series Router 6 Example SSH on a Cisco 7500 Series Router 7 Example SSH on a Cisco 12000 Series Router 8 Example Verifying SSH 10 Additional References 10 Feature Information for Configuring Secure Shell 11 Reverse SSH Enhancements 13 Finding Feature Information 13 Prerequisites for Reverse SSH Enhancements 13 Restrictions for Reverse SSH Enhancements 13 Information About Reverse SSH Enhancements 14 Reverse Telnet 14 Reverse SSH 14 How to Configure Reverse SSH Enhancements 14 Configuring Reverse SSH for Console Access 14 Configuring Reverse SSH for Modem Access 16
Contents
Troubleshooting Reverse SSH on the Client 18 Troubleshooting Reverse SSH on the Server 19 Configuration Examples for Reverse SSH Enhancements 20 Example Reverse SSH Console Access 20 Example Reverse SSH Modem Access 20 Additional References 21 Related Documents 21 Standards 21 MIBs 21 RFCs 22 Technical Assistance 22 Feature Information for Reverse SSH Enhancements 22 Secure Copy 25 Finding Feature Information 25 Prerequisites for Secure Copy 25 Information About Secure Copy 25 How Secure Copy Works 26 How to Configure Secure Copy 26 Configuring Secure Copy 26 Configuration Examples for Secure Copy 28 Example SCP Server-Side Configuration Using Local Authentication 28 Example SCP Server-Side Configuration Using Network-Based Authentication 28 Additional References 29 Feature Information for Secure Copy 30 Glossary 31 Secure Shell Version 2 Support 33 Finding Feature Information 33 Prerequisites for Secure Shell Version 2 Support 33 Restrictions for Secure Shell Version 2 Support 34 Information About Secure Shell Version 2 Support 34 Secure Shell Version 2 34 Secure Shell Version 2 Enhancements 35 Secure Shell Version 2 Enhancements for RSA Keys 35 SNMP Trap Generation 36 SSH Keyboard Interactive Authentication 36
Contents
How to Configure Secure Shell Version 2 Support 37 Configuring a Router for SSH Version 2 Using a Hostname and Domain Name 37 Configuring a Router for SSH Version 2 Using RSA Key Pairs 38 Configuring the Cisco IOS SSH Server to Perform RSA-Based User Authentication 40 Configuring the Cisco IOS SSH Client to Perform RSA-Based Server Authentication 42 Starting an Encrypted Session with a Remote Device 45 Troubleshooting Tips 45 Enabling Secure Copy Protocol on the SSH Server 45 Troubleshooting Tips 47 Verifying the Status of the Secure Shell Connection Using the show ssh Command 47 Verifying the Secure Shell Status 48 Monitoring and Maintaining Secure Shell Version 2 50 Configuration Examples for Secure Shell Version 2 Support 52 Example Configuring Secure Shell Version 1 53 Example ConfiguringSecureShellVersion2 53 Example Configuring Secure Shell Versions 1 and 2 53 Example Starting an Encrypted Session with a Remote Device 53 Example Configuring Server-Side SCP 53 Example Setting an SNMP Trap 54 Examples SSH Keyboard Interactive Authentication 54 Client-Side Debugs 54 TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and a Blank Password Change Is Made 55 TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and the Password Is Changed on First Login 55 TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and the Password Expires After Three Logins 55 Example SNMP Debugging 56 Examples SSH Debugging Enhancements 56 Where to Go Next 57 Additional References 57 Feature Information for Secure Shell Version 2 Support 58 SSH Terminal-Line Access 61 Finding Feature Information 61 Prerequisites for SSH Terminal-Line Access 61 Restrictions for SSH Terminal-Line Access 62
Secure Shell Configuration Guide, Cisco IOS Release 12.2SX iv
Contents
Information About SSH Terminal-Line Access 62 Overview of SSH Terminal-Line Access 62 How to Configure SSH Terminal-Line Access 63 Configuring SSH Terminal-Line Access 63 Verifying SSH Terminal-Line Access 65 Configuration Examples for SSH Terminal-Line Access 65 Example SSH Terminal-Line Access Configuration 65 Example SSH Terminal-Line Access for a Console Serial Line Ports Configuration 65 Additional References 66 Feature Information for SSH Terminal-Line Access 67
Note
Hereafter, unless otherwise noted, the term SSH denotes SSH Version 1 only. Finding Feature Information, page 1 Prerequisites for Configuring SSH, page 1 Restrictions for Configuring SSH, page 2 Information About Secure Shell, page 2 How to Configure SSH, page 3 Configuration Examples for SSH, page 5 Additional References, page 10 Feature Information for Configuring Secure Shell, page 11
Configure a hostname and host domain for your router by using the hostname and ip domain-name commands in global configuration mode. Generate a Rivest, Shamir and Adleman (RSA) key pair for your router. This key pair automatically enables SSH and remote authentication when the crypto key generate rsa command is entered in global configuration mode.
Note
To delete the RSA key pair, use the crypto key zeroize rsa global configuration command. Once you delete the RSA key pair, you automatically disable the SSH server. Configure user authentication for local or remote access. You can configure authentication with or without authentication, authorization, and accounting (AAA). For more information, see the Configuring Authentication Configuring Authorization and Configuring Accounting feature modules for more information.
Hereafter, unless otherwise noted, the term SSH denotes SSH Version 1 only. SSH Server, page 2 SSH Integrated Client, page 2 RSA Authentication Support, page 3
SSH Server
The SSH Server feature enables an SSH client to make a secure, encrypted connection to a Cisco router. This connection provides functionality that is similar to that of an inbound Telnet connection. Before SSH, security was limited to Telnet security. SSH allows a strong encryption to be used with the Cisco IOS software authentication. The SSH server in Cisco IOS software works with publicly and commercially available SSH clients.
connection to another Cisco router or to any other device that is running the SSH server. This connection provides functionality that is similar to that of an outbound Telnet connection except that the connection is encrypted. With authentication and encryption, the SSH client allows for secure communication over an insecure network. The SSH client in Cisco IOS software works with publicly and commercially available SSH servers. The SSH client supports the ciphers of DES, 3DES, and password authentication. User authentication is performed like that in the Telnet session to the router. The user authentication mechanisms supported for SSH are RADIUS, TACACS+, and the use of locally stored usernames and passwords.
Note
The SSH client functionality is available only when the SSH server is enabled.
Hereafter, unless otherwise noted, the term SSH denotes SSH Version 1 only. Configuring an SSH Server, page 3 Invoking an SSH Client, page 4
Note
The SSH client feature runs in user EXEC mode and has no specific configuration on the router.
Note
The SSH commands are optional and are disabled when the SSH server is disabled. If SSH parameters are not configured, then the default values are used.
SUMMARY STEPS
1. enable 2. configure terminal 3. ip ssh {timeout seconds | authentication-retries integer} 4.
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Configures SSH control parameters on your router. Select one of the SSH control variables. The seconds argument specifies the timeout in seconds, not to exceed 120 seconds. The default is 120. This setting applies to the SSH negotiation phase. Once the EXEC session starts, the standard timeouts configured for the vty apply. By default, five vtys are defined (0-4); therefore five terminal sessions are possible. After the SSH executes a shell, the vty timeout starts. The vty timeout defaults to 10 minutes. The integer argument specifies the number of authentication retries, not to exceed five authentication retries. The default is three. provided to the user. The number is the lower of the following two values: Value proposed by the client using the ssh -o numberofpasswordprompt command. Value configured on the router using the ip ssh authentication-retries integercommand, plus one.
Example:
Router(config) # ip ssh timeout 30
Step 4
Note This command can also be used to establish the number of password prompts
SUMMARY STEPS
1. enable 2. ssh -l username -vrf vrf-name ip-address
DETAILED STEPS
Command or Action Step 1 enable Purpose (Optional) Enables privileged EXEC mode.
Example:
Router> enable
(Optional) Invokes the Cisco IOS SSH client to connect to an IP host or address in the specified virtual routing and forwarding (VRF) instance.
Example:
Router# ssh -l user1 -vrf vrf1 192.0.2.1
Troubleshooting Tips
If your SSH configuration commands are rejected as illegal commands, you have not successfully generated an RSA key pair for your router. Make sure that you have specified a hostname and domain. Then use the crypto key generate rsacommand to generate an RSA key pair and enable the SSH server. When configuring the RSA key pair, you might encounter the following error messages: No hostname specified
You must configure a hostname for the router using the hostname global configuration command. See the IPsec and Quality of Service feature module for more information. No domain specified
You must configure a host domain for the router using the ip domain-name global configuration command. See the IPsec and Quality of Service feature module for more information. The number of allowable SSH connections is limited to the maximum number of vtys configured for the router. Each SSH connection uses a vty resource. SSH uses either local security or the security protocol that is configured through AAA on your router for user authentication. When configuring AAA, you must ensure that AAA is disabled on the console for user authentication. AAA authorization is disabled on the console by default. If AAA authorization is enabled on the console, disable it by configuring the no aaa authorization console command during the AAA configuration stage.
Example SSH on a Cisco 7200 Series Router Configuration Examples for SSH
Note
Hereafter, unless otherwise noted, the term SSH denotes SSH Version 1 only.
Note
The crypto key generate rsa command is not displayed in the show running-config output. Example SSH on a Cisco 7200 Series Router, page 6 Example SSH on a Cisco 7500 Series Router, page 7 Example SSH on a Cisco 12000 Series Router, page 8 Example Verifying SSH, page 10
Example SSH on a Cisco 7500 Series Router Configuration Examples for SSH
tacacs-server key cisco radius-server host 192.168.109.216 auth-port 1650 acct-port 1651 radius-server key cisco line con 0 exec-timeout 0 0 login authentication aaa7200kw transport input none line aux 0 line vty 0 4 password password end
Example SSH on a Cisco 12000 Series Router Configuration Examples for SSH
ip address 192.168.109.2 255.255.255.0 no ip directed-broadcast no ip route-cache no ip mroute-cache shutdown interface Ethernet1/2 no ip address no ip directed-broadcast no ip route-cache no ip mroute-cache interface Ethernet1/3 no ip address no ip directed-broadcast no ip route-cache no ip mroute-cache shutdown interface Ethernet1/4 no ip address no ip directed-broadcast no ip route-cache no ip mroute-cache shutdown interface Ethernet1/5 no ip address no ip directed-broadcast no ip route-cache no ip mroute-cache shutdown interface Serial2/0 ip address 10.1.1.2 255.0.0.0 no ip directed-broadcast encapsulation ppp no ip route-cache no ip mroute-cache ip classless ip route 192.168.9.0 255.255.255.0 10.1.1.1 ip route 192.168.10.0 255.255.255.0 10.1.1.1 tacacs-server host 192.168.109.216 port 9000 tacacs-server key cisco radius-server host 192.168.109.216 auth-port 1650 acct-port 1651 radius-server key cisco line con 0 exec-timeout 0 0 login authentication aaa7500kw transport input none line aux 0 transport input all line vty 0 4 end
main-cpu auto-sync startup-config ip subnet-zero no ip domain-lookup ip domain-name cisco.com ! Enter ssh commands. ip ssh timeout 60 ip ssh authentication-retries 2 interface ATM0/0 no ip address no ip directed-broadcast no ip route-cache cef shutdown interface POS1/0 ip address 10.100.100.2 255.255.255.0 no ip directed-broadcast encapsulation ppp no ip route-cache cef no keepalive crc 16 no cdp enable interface POS1/1 no ip address no ip directed-broadcast no ip route-cache cef shutdown crc 32 interface POS1/2 no ip address no ip directed-broadcast no ip route-cache cef shutdown crc 32 interface POS1/3 no ip address no ip directed-broadcast no ip route-cache cef shutdown crc 32 interface POS2/0 ip address 10.1.1.1 255.255.255.0 no ip directed-broadcast encapsulation ppp no ip route-cache cef crc 16 interface Ethernet0 ip address 172.17.110.91 255.255.255.224 no ip directed-broadcast router ospf 1 network 0.0.0.0 255.255.255.255 area 0.0.0.0 ip classless ip route 0.0.0.0 0.0.0.0 172.17.110.65 logging trap debugging tacacs-server host 172.17.116.138 tacacs-server key cisco radius-server host 172.17.116.138 auth-port 1650 acct-port 1651 radius-server key cisco line con 0 exec-timeout 0 0 login authentication aaa12000kw transport input none line aux 0 line vty 0 4
max-task-time linecard slot linecard slot linecard slot linecard slot linecard slot linecard slot linecard slot
0 1 2 3 4 5 6
To verify the status of your SSH server connections, use the show ssh command. The following example shows the SSH server connections on the router when SSH is enabled:
Router# show ssh Connection Version Encryption 0 1.5 3DES Session Started State Username guest
Additional References
Related Documents Related Topic Cisco IOS commands Authentication, authorization, and accounting (AAA) Document Title Cisco IOS Master Commands List, All Releases Configuring Accounting feature module Configuring Authentication feature module Configuring Authorization feature module
IPsec and Quality of Service feature module Secure Shell Version 2 Support feature module Cisco IOS Configuration Fundamentals Configuration Guide
No new or modified standards are supported by this -feature, and support for existing standards has not been modified by this feature. MIBs MIB No new or modified MIBs are supported by this feature, and support for existing MIBs has not been modified by this feature. MIBs Link To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL: http://www.cisco.com/go/mibs RFCs RFC No new or modified RFCs are supported by this feature. Technical Assistance Description The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password. Link http://www.cisco.com/cisco/web/support/ index.html Title --
Table 1
Releases 12.0(5)S
Feature Information The Secure Shell (SSH) feature is an application and a protocol that provides a secure replacement to the Berkeley r-tools. The protocol secures the sessions using standard cryptographic mechanisms, and the application can be used similarly to the Berkeley rexec and rsh tools. Two versions of SSH are available: SSH Version 1 and SSH Version 2. This document describes SSH Version 1.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1005R) Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.
Reverse Telnet
Cisco IOS software has for quite some time included a feature called Reverse telnet, whereby you can telnet to a certain port range and connect to terminal or auxiliary lines. Reverse telnet has often been used to connect a Cisco IOS router that has many terminal lines to the consoles of other Cisco IOS routers or to other devices. Telnet makes it easy to reach the router console from anywhere simply by telnet to the terminal server on a specific line. This telnet approach can be used to configure a router even if all network connectivity to that router is disconnected. Reverse telnet also allows modems that are attached to Cisco IOS routers to be used for dial-out (usually with a rotary device).
Reverse SSH
Reverse telnet can be accomplished using SSH. Unlike reverse telnet, SSH provides for secure connections. The Reverse SSH Enhancements feature provides you with a simplified method of configuring SSH. Using this feature, you no longer have to configure a separate line for every terminal or auxiliary line on which you want to enable SSH. The previous method of configuring reverse SSH limited the number of ports that can be accessed to 100. The Reverse SSH Enhancements feature removes the port number limitation. For information on the alternative method of configuring reverse SSH, see How to Configure Reverse SSH Enhancements, page 14.
SUMMARY STEPS
1. enable 2. configure terminal 3. line line-number ending-line-number 4. no exec 5. login authentication listname 6. transport input ssh 7. exit 8. exit 9. ssh -l userid : {number} {ip-address}
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router# line 1 3
Step 4 no exec
Example:
Router (config-line)# no exec
Example:
Router (config-line)# login authentication default
Configuring Reverse SSH for Modem Access How to Configure Reverse SSH Enhancements
Purpose Defines which protocols to use to connect to a specific line of the router. The ssh keyword must be used for the Reverse SSH Enhancements feature.
Example:
Router (config-line)# transport input ssh
Step 7 exit
Example:
Router (config-line)# exit
Step 8 exit
Example:
Router (config)# exit
Specifies the user ID to use when logging in on the remote networking device that is running the SSH server. userid --User ID. : --Signifies that a port number and terminal IP address will follow the userid argument. number --Terminal or auxiliary line number. ip-address --Terminal server IP address. delimiter and arguments are mandatory when configuring the alternative method of Reverse SSH for modem access.
Example:
Router# ssh -l lab:1 router.example.com
SUMMARY STEPS
1. enable 2. configure terminal 3. line line-number ending-line-number 4. no exec 5. login authentication listname 6. rotary group 7. transport input ssh 8. exit 9. exit 10. ssh -l userid :rotary {number} {ip-address}
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router# line 1 200
Step 4 no exec
Example:
Router (config-line)# no exec
Example:
Router (config-line)# login authentication default
Troubleshooting Reverse SSH on the Client How to Configure Reverse SSH Enhancements
Purpose Defines a group of lines consisting of one or more virtual terminal lines or one auxiliary port line.
Example:
Router (config-line)# rotary 1
Defines which protocols to use to connect to a specific line of the router. The ssh keyword must be used for the Reverse SSH Enhancements feature.
Example:
Router (config-line)# transport input ssh
Step 8 exit
Example:
Router (config-line)# exit
Step 9 exit
Example:
Router (config)# exit
Specifies the user ID to use when logging in on the remote networking device that is running the SSH server. userid --User ID. : --Signifies that a port number and terminal IP address will follow the userid argument. number --Terminal or auxiliary line number. ip-address --Terminal server IP address. delimiter and arguments are mandatory when configuring the alternative method of Reverse SSH for modem access.
Example:
Router# ssh -l lab:rotary1 router.example.com
SUMMARY STEPS
1. enable 2. debug ip ssh client
Troubleshooting Reverse SSH on the Server How to Configure Reverse SSH Enhancements
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Step 2
Example:
Router# debug ip ssh client
SUMMARY STEPS
1. enable 2. debug ip ssh 3. show ssh 4. show line
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Step 2
debug ip ssh
Example:
Router# debug ip ssh
Example Reverse SSH Console Access Configuration Examples for Reverse SSH Enhancements
Example:
Router# show ssh
Step 4
show line
Example:
Router# show line
Client Configuration The following commands configured on the SSH client will form the reverse SSH session with lines 1, 2, and 3, respectively:
ssh -l lab:1 router.example.com ssh -l lab:2 router.example.com ssh -l lab:3 router.example.com
The following command shows that reverse SSH will connect to the first free line in the rotary group:
ssh -l lab:rotary1 router.example.com
Additional References
Related Documents, page 21 Standards, page 21 MIBs, page 21 RFCs, page 22 Technical Assistance, page 22
Related Documents
Related Topic Cisco IOS commands Configuring Secure Shell Document Title Cisco IOS Master Commands List, All Releases See the following modules: Security commands Configuring Secure Shell Secure Shell Version 2 Support SSH Terminal-Line Access
Standards
Standards Title No new or modified standards are supported by this -feature.
MIBs
MIBs None MIBs Link To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL: http://www.cisco.com/go/mibs
RFCs
RFCs None Title --
Technical Assistance
Description The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password. Link http://www.cisco.com/cisco/web/support/ index.html
Table 2
Releases 12.3(11)T
Feature Information The Reverse SSH Enhancements feature, which is supported for SSH Version 1 and 2, provides an alternative way to configure reverse Secure Shell (SSH) so that separate lines do not need to be configured for every terminal or auxiliary line on which SSH must be enabled. This feature also eliminates the rotary-group limitation. This feature was introduced in Cisco IOS Release 12.3(11)T. The following command was introduced: ssh.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1005R) Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.
Technical Assistance
Secure Copy
The Secure Copy (SCP) feature provides a secure and authenticated method for copying router configuration or router image files. SCP relies on Secure Shell (SSH), an application and a protocol that provide a secure replacement for the Berkeley r-tools. Finding Feature Information, page 25 Prerequisites for Secure Copy, page 25 Information About Secure Copy, page 25 How to Configure Secure Copy, page 26 Configuration Examples for Secure Copy, page 28 Additional References, page 29 Feature Information for Secure Copy, page 30 Glossary, page 31
Note
Enable SCP option while using pscp.exe with the Cisco IOS software.
SUMMARY STEPS
1. enable 2. configure terminal 3. aaa new-model 4. aaa authentication login {default | list-name} method1[method2...] 5. aaa authorization {network | exec | commands level | reverse-access | configuration} {default | listname} [method1 [method2...]] 6. username name [privilege level] {password encryption-type encrypted-password} 7. ip scp server enable 8. show running-config 9. debug ip scp
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router(config)# aaa new-model
Example:
Router(config)# aaa authentication login default group tacacs+
Step 5 aaa authorization {network | exec | commands level | reverseaccess | configuration} {default | list-name} [method1 [method2...]]
Example:
Router(config)# aaa authorization exec default group tacacs+
determine if the user is allowed to run an EXEC shell; therefore, you must use it when you configure SCP.
Example:
Router(config)# username superuser privilege 2 password 0 superpassword
Example:
Router(config)# ip scp server enable
Example SCP Server-Side Configuration Using Local Authentication Configuration Examples for Secure Copy
Example:
Router# show running-config
Example:
Router# debug ip scp
Additional References
Related Documents Related Topic Cisco IOS commands Secure Shell Version 1 and 2 support Document Title Cisco IOS Master Commands List, All Releases Configuring Secure Shell module Secure Shell Version 2 Support module
Cisco IOS Security Command Reference Authentication, Authorization, and Accounting (AAA) section of Cisco IOS Security Configuration Guide: Securing User Services , Release 15.0
Standards Standards None MIBs MIBs None MIBs Link To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL: http://www.cisco.com/go/mibs RFCs RFCs None Title -Title --
Technical Assistance Description The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password. Link http://www.cisco.com/cisco/web/support/ index.html
Feature Information The Secure Copy (SCP) feature provides a secure and authenticated method for copying router configuration or router image files. SCP relies on Secure Shell (SSH), an application and a protocol that provide a secure replacement for the Berkeley rtools. This feature was introduced in Cisco IOS Release 12.2(2)T. This feature was integrated into Cisco IOS Release 12.0(21)S. This feature was integrated into Cisco IOS Release 12.2(25)S. The following commands were introduced or modified: debug ip scp, ip scp server enable.
Glossary
AAA --authentication, authorization, and accounting. Framework of security services that provide the method for identifying users (authentication), for remote access control (authorization), and for collecting and sending security server information used for billing, auditing, and reporting (accounting). rcp --remote copy. Relying on Remote Shell (Berkeley r-tools suite) for security, rcp copies files, such as router images and startup configurations, to and from routers. SCP --secure copy. Relying on SSH for security, SCP support allows the secure and authenticated copying of anything that exists in the Cisco IOS File System. SCP is derived from rcp. SSH --Secure Shell. Application and a protocol that provide a secure replacement for the Berkeley r-tools. The protocol secures the sessions using standard cryptographic mechanisms, and the application can be used similarly to the Berkeley rexec and rsh tools. SSH Version 1 is implemented in the Cisco IOS software.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1005R) Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.
Note
The SSH Version 2 server is supported in Cisco IOS Release 12.3(4)T, 12.3(2)XE, 12.2(25)S, and 12.3(7)JA; the SSH Version 2 client is supported beginning with Cisco IOS Release 12.3(7)T and is supported in Cisco IOS Release12.3(7)JA. (The SSH client runs both the SSH Version 1 protocol and the Version 2 protocol and is supported in both k8 and k9 images in Cisco IOS Release 12.3(4)T.) For more information about downloading a software image, refer to Cisco IOS Configuration Fundamentals Configuration Guide, Release 12.4T and Cisco IOS Network Management Configuration Guide, Release 15.0.
Note
SSH Version 1 is a protocol that has never been defined in a standard. If you do not want your router to fall back to the undefined protocol (Version 1), you should use the ip ssh version command and specify Version 2. The ip ssh rsa keypair-name command was also introduced in Cisco IOS Release 12.3(4)T so that you can enable an SSH connection using the RSA keys that you have configured. Previously, SSH was linked
Secure Shell Version 2 Enhancements Information About Secure Shell Version 2 Support
to the first RSA keys that were generated (that is, SSH was enabled when the first RSA key pair was generated). The behavior still exists, but by using the ip ssh rsa keypair-name command, you can overcome that behavior. If you configure the ip ssh rsa keypair-name command with a key pair name, SSH is enabled if the key pair exists, or SSH will be enabled if the key pair is generated later. If you use this command to enable SSH, you are not forced to configure a hostname and a domain name, which was required in SSH Version 1 of the Cisco IOS software.
Note
The login banner is supported in SSH Version 2, but it is not supported in Secure Shell Version 1.
using the server host key. If the server is successfully authenticated, the session establishment continues; otherwise it is terminated and displays a Server Authentication Failed message.
Note
Storing public keys on a server uses memory; therefore, the number of public keys configurable on an SSH server is restricted to ten users, with a maximum of two public keys per user.
Note
RSA-based user authentication is supported by the Cisco IOS server, but Cisco IOS clients cannot propose public key as an authentication method. If the Cisco IOS server receives a request from an open SSH client for RSA-based authentication, the server accepts the authentication request.
Note
For server authentication, configure the RSA public key of the server manually and configure the ip ssh stricthostkeycheck command on the Cisco IOS SSH client.
Note
When you configure the snmp-server host command, the IP address must be the address of the PC that has the SSH (telnet) client and that has IP connectivity to the SSH server. For an example of an SNMP trap generation configuration, see the Example Setting an SNMP Trap, page 54. You must also turn on SNMP debugging using the debug snmp packet command to display the traps. The trap information includes information such as the number of bytes sent and the protocol that was used for the SSH session. For an example of SNMP debugging, see the Example SNMP Debugging, page 56.
For examples of various scenarios in which the SSH Keyboard Interactive Authentication feature has been automatically enabled, see the Examples SSH Keyboard Interactive Authentication, page 54.
Configuring a Router for SSH Version 2 Using a Hostname and Domain Name How to Configure Secure Shell Version 2 Support
Configuring a Router for SSH Version 2 Using a Hostname and Domain Name
Perform this task to configure a router for SSH Version 2 using a hostname and domain name. You may also configure SSH Version 2 by using the RSA key pair configuration (see the Configuring a Router for SSH Version 2 Using RSA Key Pairs, page 38).
SUMMARY STEPS
1. enable 2. configure terminal 3. hostname hostname 4. ip domain-name name 5. crypto key generate rsa 6. ip ssh [time-out seconds | authentication-retries integer] 7. ip ssh version [1 | 2]
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Configuring a Router for SSH Version 2 Using RSA Key Pairs How to Configure Secure Shell Version 2 Support
Example:
Router(config)# hostname cisco 7200
Example:
Router(config)# ip domain-name example.com
Example:
Router(config)# crypto key generate rsa
Step 6 ip ssh [time-out seconds | authentication-retries integer] (Optional) Configures SSH control variables on your router.
Example:
Router(config)# ip ssh time-out 120
Example:
Router(config)# ip ssh version 1
SUMMARY STEPS
1. enable 2. configure terminal 3. ip ssh rsa keypair-name keypair-name 4. crypto key generate rsa usage-keys label key-label modulus modulus-size 5. ip ssh [time-out seconds | authentication-retries integer] 6. ip ssh version 2
Secure Shell Version 2 Support How to Configure Secure Shell Version 2 Support
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router(config)# ip ssh rsa keypair-name sshkeys
Step 4 crypto key generate rsa usage-keys label key-label modulus modulus-size
Enables the SSH server for local and remote authentication on the router. For SSH Version 2, the modulus size must be at least 768 bits. rsa command. After you have deleted the RSA key pair, you automatically disable the SSH server.
Example:
Router(config)# crypto key generate rsa usagekeys label sshkeys modulus 768
Note To delete the RSA key pair, use the crypto key zeroize
Step 5 ip ssh [time-out seconds | authentication-retries integer] Configures SSH control variables on your router.
Example:
Router(config)# ip ssh time-out 12
Example:
Router(config)# ip ssh version 2
Configuring the Cisco IOS SSH Server to Perform RSA-Based User Authentication How to Configure Secure Shell Version 2 Support
Configuring the Cisco IOS SSH Server to Perform RSA-Based User Authentication
Perform this task to configure the Cisco IOS SSH server to perform RSA-based user authentication. The user authentication is successful if the RSA public key stored on the server is verified with the public or the private key pair stored on the client.
SUMMARY STEPS
1. enable 2. configure terminal 3. hostname name 4. ip domain-name name 5. crypto key generate rsa 6. ip ssh pubkey-chain 7. username username 8. key-string 9. exit 10. key-hash key-type key-name 11. end
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router(config)# hostname host1
Secure Shell Version 2 Support How to Configure Secure Shell Version 2 Support
Purpose Defines a default domain name that the Cisco IOS software uses to complete unqualified hostnames.
Example:
Router(config)# ip domain-name name1
Example:
Router(config)# crypto key generate rsa
Configures SSH-RSA keys for user and server authentication on the SSH server and enters public-key configuration mode.
Example:
Router(config)# ip ssh pubkey-chain
Configures the SSH username and enters public-key user configuration mode.
Example:
Router(conf-ssh-pubkey)# username user1
Step 8 key-string
Specifies the RSA public key of the remote peer and enters publickey data configuration mode.
Note You can obtain the public key value from an open SSH client;
Example:
Router(conf-ssh-pubkey-user)# key-string
Step 9 exit
Example:
Router(conf-ssh-pubkey-data)# exit
Configuring the Cisco IOS SSH Client to Perform RSA-Based Server Authentication How to Configure Secure Shell Version 2 Support
Purpose (Optional) Specifies the SSH key type and version. The key type must be ssh-rsa for configuration of private public key pairs. This step is optional only if the key-string command is configured. You must configure either the key-string command or the keyhash command. pubkey string or you can also copy the hash value from another Cisco IOS router. Entering the public key data using the keystring command is the preferred way to enter the public key data for the first time.
Example:
Router(conf-ssh-pubkey-data)# key-hash ssh-rsa key1
Note You can use a hashing software to compute the hash of the
Step 11 end
Example:
Router(conf-ssh-pubkey-data)# end
Configuring the Cisco IOS SSH Client to Perform RSA-Based Server Authentication
Perform this task to configure the Cisco IOS SSH client to perform RSA-based server authentication.
SUMMARY STEPS
1. enable 2. configure terminal 3. hostname name 4. ip domain-name name 5. crypto key generate rsa 6. ip ssh pubkey-chain 7. server server-name 8. key-string 9. exit 10. key-hash key-type key-name 11. end 12. configure terminal 13. ip ssh stricthostkeycheck
Secure Shell Version 2 Support How to Configure Secure Shell Version 2 Support
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router(config)# hostname host1
Defines a default domain name that the Cisco IOS software uses to complete unqualified hostnames.
Example:
Router(config)# ip domain-name name1
Example:
Router(config)# crypto key generate rsa
Configures SSH-RSA keys for user and server authentication on the SSH server and enters public-key configuration mode.
Example:
Router(config)# ip ssh pubkey-chain
Enables the SSH server for public-key authentication on the router and enters public-key server configuration mode.
Example:
Router(conf-ssh-pubkey)# server server1
Secure Shell Version 2 Support How to Configure Secure Shell Version 2 Support
Purpose Specifies the RSA public-key of the remote peer and enters public key data configuration mode.
Note You can obtain the public key value from an open SSH client;
Example:
Router(conf-ssh-pubkey-server)# key-string
Step 9 exit
Exits public-key data configuration mode and enters public-key server configuration mode.
Example:
Router(conf-ssh-pubkey-data)# exit
(Optional) Specifies the SSH key type and version. The key type must be ssh-rsa for configuration of private/public key pairs. This step is optional only if the key-string command is configured. You must configure either the key-string command or the keyhash command. public key string or you can copy the hash value from another Cisco IOS router. Entering the public key data using the keystring command is the preferred way to enter the public key data for the first time.
Example:
Router(conf-ssh-pubkey-server)# key-hash ssh-rsa key1
Note You can use a hashing software to compute the hash of the
Step 11 end
Example:
Router(conf-ssh-pubkey-server)# end
Example:
Router# configure terminal
Ensures that the server authentication takes place. The connection is terminated on a failure.
Example:
Router(config)# ip ssh stricthostkeycheck
Note
The device you want to connect with must support an SSH server that has an encryption algorithm that is supported in Cisco IOS software.
SUMMARY STEPS
1. ssh [-v {1 | 2}][-c {3des | aes128-cbc | aes192-cbc | aes256-cbc}] [-m {hmac-md5 | hmac-md5-96 | hmac-sha1 | hmac-sha1-96}] [l userid] [-o numberofpasswordprompts n] [-p port-num]{ip-addr | hostname} [command]
DETAILED STEPS
Command or Action Step 1 ssh [-v {1 | 2}][-c {3des | aes128-cbc | aes192-cbc | aes256-cbc}] [-m {hmac-md5 | hmacmd5-96 | hmac-sha1 | hmac-sha1-96}] [l userid] [-o numberofpasswordprompts n] [-p portnum]{ip-addr | hostname} [command] Purpose Starts an encrypted session with a remote networking device.
Example:
Router# ssh -v 2 -c aes256-cbc -m hmac-sha1-96 -l user2 10.76.82.24
Troubleshooting Tips
The ip ssh version command can be used for troubleshooting your SSH configuration. By changing versions, you can determine which SSH version has a problem.
SUMMARY STEPS
1. enable 2. configure terminal 3. aaa new-model 4. aaa authentication login default local 5. aaa authorization exec default local 6. username name privilege privilege-level password password 7. ip ssh time-out seconds 8. ip ssh authentication-retries integer 9. ip scp server enable
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router(config)# aaa new-model
Sets AAA authentication at login to use the local username database for authentication.
Example:
Router(config)# aaa authentication login default local
Example:
Router(config)# aaa authorization exec default local
Sets the parameters that restrict user access to a network; runs the authorization to determine if the user ID is allowed to run an EXEC shell, and specifies that the system uses the local database for authorization.
Verifying the Status of the Secure Shell Connection Using the show ssh Command Troubleshooting Tips
Purpose Establishes a username-based authentication system, and specifies the username, privilege level, and an unencrypted password.
Note The minimum value for the privilege-level argument is 15.
Example:
Router(config)# username samplename privilege 15 password password1
A privilege level of less than 15 results in the connection closing. Sets the time interval (in seconds) that the router waits for the SSH client to respond.
Example:
Router(config)# ip ssh time-out 120
Sets the number of authentication attempts after which the interface is reset.
Example:
Router(config)# ip ssh authentication-retries 3
Example:
Router(config)# ip scp server enable
Troubleshooting Tips
To troubleshoot SCP authentication problems, use the debug ip scpcommand.
Verifying the Status of the Secure Shell Connection Using the show ssh Command
To display the status of the SSH connection on your router, use the show ssh command.
SUMMARY STEPS
1. enable 2. show ssh
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Step 2
show ssh
Example:
Router# show ssh
Examples The following output examples from the show ssh command display status about various SSH Version 1 and Version 2 connections. Version 1 and Version 2 Connections
----------------------------------------------------------------------Router# show ssh Connection Version Encryption State Username 0 1.5 3DES Session started lab Connection Version Mode Encryption Hmac State Username 1 2.0 IN aes128-cbc hmac-md5 Session started lab 1 2.0 OUT aes128-cbc hmac-md5 Session started lab -------------------------------------------------------------------------
SUMMARY STEPS
1. enable 2. show ip ssh
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Step 2
show ip ssh
Example:
Router# show ip ssh
Examples The following sample output from the show ip ssh command displays the version of SSH that is enabled, the authentication timeout values, and the number of authentication retries: Version 1 and Version 2 Connections
----------------------------------------------------------------------Router# show ip ssh SSH Enabled - version 1.99 Authentication timeout: 120 secs; Authentication retries: 3 -----------------------------------------------------------------------
SUMMARY STEPS
1. enable 2. debug ip ssh 3. debug snmp packet
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# debug ip ssh
Displays information about every SNMP packet sent or received by the router.
Example:
Router# debug snmp packet
Example The following sample output from the debug ip ssh command shows that the digit 2 keyword has been assigned, signifying that it is an SSH Version 2 connection:
Router# debug ip ssh 00:33:55: SSH1: starting SSH control process 00:33:55: SSH1: sent protocol version id SSH-1.99-Cisco-1.25 00:33:55: SSH1: protocol version id is - SSH-2.0-OpenSSH_2.5.2p2 00:33:55: SSH2 1: send: len 280 (includes padlen 4) 00:33:55: SSH2 1: SSH2_MSG_KEXINIT sent 00:33:55: SSH2 1: ssh_receive: 536 bytes received 00:33:55: SSH2 1: input: packet len 632 00:33:55: SSH2 1: partial packet 8, need 624, maclen 0 00:33:55: SSH2 1: ssh_receive: 96 bytes received 00:33:55: SSH2 1: partial packet 8, need 624, maclen 0 00:33:55: SSH2 1: input: padlen 11 00:33:55: SSH2 1: received packet type 20 00:33:55: SSH2 1: SSH2_MSG_KEXINIT received 00:33:55: SSH2: kex: client->server aes128-cbc hmac-md5 none 00:33:55: SSH2: kex: server->client aes128-cbc hmac-md5 none 00:33:55: SSH2 1: expecting SSH2_MSG_KEXDH_INIT
00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:55: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:33:56: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: width 80 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04:
SSH2 1: ssh_receive: 144 bytes received SSH2 1: input: packet len 144 SSH2 1: partial packet 8, need 136, maclen 0 SSH2 1: input: padlen 5 SSH2 1: received packet type 30 SSH2 1: SSH2_MSG_KEXDH_INIT received SSH2 1: signature length 111 SSH2 1: send: len 384 (includes padlen 7) SSH2: kex_derive_keys complete SSH2 1: send: len 16 (includes padlen 10) SSH2 1: newkeys: mode 1 SSH2 1: SSH2_MSG_NEWKEYS sent SSH2 1: waiting for SSH2_MSG_NEWKEYS SSH2 1: ssh_receive: 16 bytes received SSH2 1: input: packet len 16 SSH2 1: partial packet 8, need 8, maclen 0 SSH2 1: input: padlen 10 SSH2 1: newkeys: mode 0 SSH2 1: received packet type 2100:33:55: SSH2 1: SSH2_MSG_NEWKEYS received SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen 16 SSH2 1: MAC #3 ok SSH2 1: input: padlen 10 SSH2 1: received packet type 5 SSH2 1: send: len 32 (includes padlen 10) SSH2 1: done calc MAC out #3 SSH2 1: ssh_receive: 64 bytes received SSH2 1: input: packet len 48 SSH2 1: partial packet 16, need 32, maclen 16 SSH2 1: MAC #4 ok SSH2 1: input: padlen 9 SSH2 1: received packet type 50 SSH2 1: send: len 32 (includes padlen 13) SSH2 1: done calc MAC out #4 SSH2 1: ssh_receive: 160 bytes received SSH2 1: input: packet len 64 SSH2 1: partial packet 16, need 48, maclen 16 SSH2 1: MAC #5 ok SSH2 1: input: padlen 13 SSH2 1: received packet type 50 SSH2 1: send: len 16 (includes padlen 10) SSH2 1: done calc MAC out #5 SSH2 1: authentication successful for lab SSH2 1: input: packet len 64 SSH2 1: partial packet 16, need 48, maclen 16 SSH2 1: MAC #6 ok SSH2 1: input: padlen 6 SSH2 1: received packet type 2 SSH2 1: ssh_receive: 64 bytes received SSH2 1: input: packet len 48 SSH2 1: partial packet 16, need 32, maclen 16 SSH2 1: MAC #7 ok SSH2 1: input: padlen 19 SSH2 1: received packet type 90 SSH2 1: channel open request SSH2 1: send: len 32 (includes padlen 10) SSH2 1: done calc MAC out #6 SSH2 1: ssh_receive: 192 bytes received SSH2 1: input: packet len 64 SSH2 1: partial packet 16, need 48, maclen 16 SSH2 1: MAC #8 ok SSH2 1: input: padlen 13 SSH2 1: received packet type 98 SSH2 1: pty-req request SSH2 1: setting TTY - requested: height 24, width 80; set: height 24, SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 1: 1: 1: 1: 1: 1: input: packet len 96 partial packet 16, need 80, maclen 16 MAC #9 ok input: padlen 11 received packet type 98 x11-req request
Secure Shell Version 2 Support Configuration Examples for Secure Shell Version 2 Support
00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:04: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:07: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08: 00:34:08:
SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen SSH2 1: MAC #10 ok SSH2 1: input: padlen 12 SSH2 1: received packet type 98 SSH2 1: shell request SSH2 1: shell message received SSH2 1: starting shell for vty SSH2 1: send: len 48 (includes padlen 18) SSH2 1: done calc MAC out #7 SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen SSH2 1: MAC #11 ok SSH2 1: input: padlen 17 SSH2 1: received packet type 94 SSH2 1: send: len 32 (includes padlen 17) SSH2 1: done calc MAC out #8 SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen SSH2 1: MAC #12 ok SSH2 1: input: padlen 17 SSH2 1: received packet type 94 SSH2 1: send: len 32 (includes padlen 17) SSH2 1: done calc MAC out #9 SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen SSH2 1: MAC #13 ok SSH2 1: input: padlen 17 SSH2 1: received packet type 94 SSH2 1: send: len 32 (includes padlen 17) SSH2 1: done calc MAC out #10 SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen SSH2 1: MAC #14 ok SSH2 1: input: padlen 17 SSH2 1: received packet type 94 SSH2 1: send: len 32 (includes padlen 17) SSH2 1: done calc MAC out #11 SSH2 1: ssh_receive: 48 bytes received SSH2 1: input: packet len 32 SSH2 1: partial packet 16, need 16, maclen SSH2 1: MAC #15 ok SSH2 1: input: padlen 17 SSH2 1: received packet type 94 SSH2 1: send: len 32 (includes padlen 16) SSH2 1: done calc MAC out #12 SSH2 1: send: len 48 (includes padlen 18) SSH2 1: done calc MAC out #13 SSH2 1: send: len 16 (includes padlen 6) SSH2 1: done calc MAC out #14 SSH2 1: send: len 16 (includes padlen 6) SSH2 1: done calc MAC out #15 SSH1: Session terminated normally
16
16
16
16
16
16
Example Configuring Secure Shell Version 1 Configuration Examples for Secure Shell Version 2 Support
Examples SSH Keyboard Interactive Authentication, page 54 Example SNMP Debugging, page 56 Examples SSH Debugging Enhancements, page 56
Example ConfiguringSecureShellVersion2
The following example shows how to configure SSH Version 2:
Router# configure terminal Enter configuration commands, one per line. Router(config)# ip ssh version 2 Router(config)# end End with CNTL/Z.
Client-Side Debugs
In the following example, client-side debugs are turned on and the maximum number of prompts = six, (three for the SSH Keyboard Interactive Authentication method and for the password method of authentication).
Password: Password: Password: Password: Password: Password: cisco123 Last login: Tue Dec 6 13:15:21 2005 from 10.76.248.213 user1@courier:~> exit logout [Connection to 10.76.248.200 closed by foreign host] Router1# debug ip ssh client SSH Client debugging is on Router1# ssh -l lab 10.1.1.3 Password: *Nov 17 12:50:53.199: SSH0: sent protocol version id SSH-1.99-Cisco-1.25 *Nov 17 12:50:53.199: SSH CLIENT0: protocol version id is - SSH-1.99-Cisco-1.25 *Nov 17 12:50:53.199: SSH CLIENT0: sent protocol version id SSH-1.99-Cisco-1.25 *Nov 17 12:50:53.199: SSH CLIENT0: protocol version exchange successful *Nov 17 12:50:53.203: SSH0: protocol version id is - SSH-1.99-Cisco-1.25 *Nov 17 12:50:53.335: SSH CLIENT0: key exchange successful and encryption on *Nov 17 12:50:53.335: SSH2 CLIENT 0: using method keyboard-interactive Password: Password: Password: *Nov 17 12:51:01.887: SSH2 CLIENT 0: using method password authentication Password: Password: lab Router2> *Nov 17 12:51:11.407: SSH2 CLIENT 0: SSH2_MSG_USERAUTH_SUCCESS message received *Nov 17 12:51:11.407: SSH CLIENT0: user authenticated *Nov 17 12:51:11.407: SSH2 CLIENT 0: pty-req request sent *Nov 17 12:51:11.411: SSH2 CLIENT 0: shell request sent *Nov 17 12:51:11.411: SSH CLIENT0: session open
Secure Shell Version 2 Support TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and a Blank Password Change Is Made
TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and a Blank Password Change Is Made
In the following example, a TACACS+ access control server (ACS) is the back-end AAA server; the ChPass feature is enabled, and a blank password change is accomplished using the SSH Keyboard Interactive Authentication method:
Router1# ssh -l cisco 10.1.1.3 Password: Old Password: cisco New Password: cisco123 Re-enter New password: cisco123 Router2> exit [Connection to 10.1.1.3 closed by foreign host]
TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and the Password Is Changed on First Login
In the following example, a TACACS+ ACS is the back-end server, and the ChPass feature is enabled. The password is changed on the first login using the SSH Keyboard Interactive Authentication method.
Router1# ssh -l cisco 10.1.1.3 Password: cisco Your password has expired. Enter a new one now. New Password: cisco123 Re-enter New password: cisco123 Router2> exit [Connection to 10.1.1.3 closed by foreign host] Router1# ssh -l cisco 10.1.1.3 Password:cisco1 Your password has expired. Enter a new one now. New Password: cisco Re-enter New password: cisco12 The New and Re-entered passwords have to be the same. Try again. New Password: cisco Re-enter New password: cisco Router2>
TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and the Password Expires After Three Logins
In the following example, a TACACS+ ACS is the back-end AAA server, and the ChPass feature is enabled. The password expires after three logins using the SSH Keyboard Interactive Authentication method.
Router# ssh -l cisco. 10.1.1.3 Password: cisco Router2> exit [Connection to 10.1.1.3 closed by foreign host] Router1# ssh -l cisco 10.1.1.3 Password: cisco Router2> exit Router1# ssh -l cisco 10.1.1.3 Password: cisco Router2> exit [Connection to 10.1.1.3 closed by foreign host] Router1# ssh -l cisco 10.1.1.3
Example SNMP Debugging TACACS ACS Is the Back-end AAA Server ChPass Is Enabled and the Password Expires After Three Logins
Password: cisco Your password has expired. Enter a new one now. New Password: cisco123 Re-enter New password: cisco123 Router2>
The following is sample output from the debug ip ssh packetcommand. The output provides debugging information about the SSH packet.
Router# debug ip ssh packet 00:05:43: SSH2 0: send:packet of length 280 (length also includes padlen of 4) 00:05:43: SSH2 0: ssh_receive: 64 bytes received 00:05:43: SSH2 0: input: total packet length of 280 bytes 00:05:43: SSH2 0: partial packet length(block size)8 bytes,needed 272 bytes, maclen 0
00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43: 00:05:43:
SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2 SSH2
0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0: 0:
ssh_receive: 64 bytes received partial packet length(block size)8 bytes,needed 272 bytes, maclen ssh_receive: 64 bytes received partial packet length(block size)8 bytes,needed 272 bytes, maclen ssh_receive: 64 bytes received partial packet length(block size)8 bytes,needed 272 bytes, maclen ssh_receive: 24 bytes received partial packet length(block size)8 bytes,needed 272 bytes, maclen input: padlength 4 bytes ssh_receive: 64 bytes received input: total packet length of 144 bytes partial packet length(block size)8 bytes,needed 136 bytes, maclen ssh_receive: 64 bytes received partial packet length(block size)8 bytes,needed 136 bytes, maclen ssh_receive: 16 bytes received partial packet length(block size)8 bytes,needed 136 bytes, maclen input: padlength 6 bytes signature length 143 send:packet of length 448 (length also includes padlen of 7) send:packet of length 16 (length also includes padlen of 10) newkeys: mode 1 ssh_receive: 16 bytes received input: total packet length of 16 bytes partial packet length(block size)8 bytes,needed 8 bytes, maclen 0 input: padlength 10 bytes newkeys: mode 0 ssh_receive: 52 bytes received input: total packet length of 32 bytes partial packet length(block size)16 bytes,needed 16 bytes, maclen
0 0 0 0
0 0 0
20
Where to Go Next
You have to use a SSH remote device that supports SSH Version 2, and you have to connect to a Cisco IOS router.
Additional References
Related Documents Related Topic Cisco IOS commands AAA Document Title Cisco IOS Master Commands List, All Releases Cisco IOS Security Configuration Guide: Securing User Services Configuring Secure Shell module in the Cisco IOS Security Configuration Guide: Securing User Services . Cisco IOS Debug Command Reference Cisco IOS Configuration Fundamentals Configuration Guide Cisco IOS Network Management Configuration Guide
Debugging commands Downloading a Cisco software image Cisco IOS configuration fundamentals
Secure Shell Version 2 Support Feature Information for Secure Shell Version 2 Support
Document Title Cisco IOS Security Configuration Guide: Secure Connectivity Cisco IOS Security Command Reference Configuring SNMP Support module in the Cisco IOS Network Management Configuration Guide
Standards Standards IETF Secure Shell Version 2 Draft Standards MIBs MIBs No new or modified MIBs are supported and support for existing MIBs has not been modified. MIBs Link To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL: http://www.cisco.com/go/mibs RFCs RFCs No new or modified RFCs are supported and support for existing RFCs has not been modified. Technical Assistance Description The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password. Link http://www.cisco.com/cisco/web/support/ index.html Title -Title Internet Engineering Task Force website
Secure Shell Version 2 Support Feature Information for Secure Shell Version 2 Support
release train. Unless noted otherwise, subsequent releases of that software release train also support that feature. Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 4 Feature Information for Secure Shell Version 2 Support
Feature Information The Secure Shell Version 2 Support feature allows you to configure Secure Shell (SSH) Version 2 (SSH Version 1 support was implemented in an earlier Cisco IOS software release). SSH runs on top of a reliable transport layer and provides strong authentication and encryption capabilities. In 12.3(11)T, support was added for the Cisco 10000 series router. The following commands were introduced or modified: debug ip ssh, ip ssh min dh size, ip ssh rsa keypair-name, ip ssh version, ssh.
Secure Shell Version 2 Client and 12.0(32)SY 12.3(7)JA 12.4(17) Server Support
The Cisco IOS image was updated to provide for the automatic generation of SNMP traps when an SSH session terminates. This feature, also known as Generic Message Authentication for SSH, is a method that can be used to implement different types of authentication mechanisms. Basically, any currently supported authentication method that requires only user input can be performed with this feature.
12.4(18) 12.2(33)SXH3
Feature Information The Secure Shell Version 2 Enhancements feature includes a number of additional capabilities such as support for VRF aware SSH, SSH debug enhancements, and DH Group 14 and Group 16 exchange support. In Cisco IOS 15.1(2)S, support was added for the Cisco 7600 series router. The following commands were introduced or modified: debug ip ssh, ip ssh dh min size.
15.0(1)M 15.1(1)S
The Secure Shell Version 2 Enhancements for RSA Keys feature includes a number of additional capabilities to support RSA key-based user authentication for SSH and SSH server host key storage and verification. The following commands were introduced or modified: ip ssh pubkey-chain, ip ssh stricthostkeycheck.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1005R) Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.
Note
The SSH Terminal-Line Access feature is available on any image that contains SSH.
Note
The session slot command that is used to start a session with a module requires Telnet to be accepted on the virtual tty (vty) lines. When you restrict vty lines only to SSH, you cannot use the command to communicate with the modules. This applies to any Cisco IOS device where the user can telnet to a module on the device.
Note
SUMMARY STEPS
1. enable 2. configure terminal 3. line line-number [ending-line-number] 4. no exec 5. login {local | authentication listname} 6. rotary group 7. transport input {all | ssh} 8. exit 9. ip ssh port portnum rotary group
DETAILED STEPS
Command or Action Step 1 enable Purpose Enables privileged EXEC mode.
Example:
Router> enable
Example:
Router# configure terminal
Example:
Router(config)# line 1 200
must be configured for each line. This may be done through the use of a local username and password stored on the router, through the use of TACACS+, or through the use of RADIUS. Neither Line passwords nor the enable password are sufficient to be used with SSH. Step 4 no exec Disables exec processing on each of the lines.
Example:
Router(config-line)# no exec
Example:
Router(config-line)# login authentication default
Example:
Router(config-line)# rotary 1
Example:
Router(config-line)# transport input ssh
Verifying SSH Terminal-Line Access Configuration Examples for SSH Terminal-Line Access
Example:
Router(config-line)# exit
Enables secure network access to the tty lines. Use this command to connect the portnum argument with the rotary groupargument, which is associated with a line or group of lines. number chosen in Step 6.
Example:
Router(config)# ip ssh port 2000 rotary 1
Note The group argument must correspond with the rotary group
Example SSH Terminal-Line Access for a Console Serial Line Ports Configuration
The following example shows how to configure the SSH Terminal-Line Access feature to access the console or serial line interface of various devices. For this type of access, each line is put into its own rotary, and each rotary is used for a single port. In this example, lines 1 through 3 are used; the port (line) mappings of the configuration are shown in the table below.
Table 5
Line Number 1 2 3
line 1 no exec login authentication default rotary 1 transport input ssh line 2 no exec login authentication default rotary 2 transport input ssh line 3 no exec login authentication default rotary 3 transport input ssh ip ssh port 2001 rotary 1 3
Additional References
Related Documents Related Topic Cisco IOS commands SSH SSH commands Dial Technologies Dial commands Downloading a software image Document Title Cisco IOS Master Commands List, All Releases Cisco IOS Security Configuration Guide: Securing User Services Cisco IOS Security Command Reference Cisco IOS Dial Technologies Configuration Guide Cisco IOS Dial Technologies Command Reference Cisco IOS Configuration Fundamentals Configuration Guide
MIBs MIB MIBs Link To locate and download MIBs for selected platforms, Cisco software releases, and feature sets, use Cisco MIB Locator found at the following URL: http://www.cisco.com/go/mibs RFCs RFC None. Technical Assistance Description The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password. Link http://www.cisco.com/cisco/web/support/ index.html Title --
Table 6
Feature Information The SSH Terminal-Line Access feature provides users secure access to tty (text telephone) lines. tty allows the hearing- and speech-impaired to communicate by using a telephone to type messages. This feature was introduced in Cisco IOS Release 12.2(4)JA. This feature was integrated into Cisco IOS Release 12.2(15)T. This feature was integrated into Cisco IOS Release 12.2(6th)S. The following command was introduced or modified: ip ssh port.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1005R) Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.