Chapter 14. Implementing Switch Security

<feature><title>Objectives</title>

This chapter covers the following Cisco-specific objectives for the “Implement a small switched network” section of the 640-822 ICND1 exam:

<objective>

Implement and verify basic security for a switch (port security, deactivate ports)

</objective>
<objective>

Verify network status and switch operation using basic utilities (including: ping, traceroute, telnet, SSH, arp, ipconfig), SHOW & DEBUG commands

</objective>
</feature>
<feature><title>Outline</title> </feature><feature><title>Study Strategies</title>
  • Part of being thorough in securing your switched network is to think like an attacker. With that in mind, try to consider ways in which your network is vulnerable and how you would go about gaining access if you were the attacker.

  • Many of the topics discussed in this chapter can also be applied to securing your router. Keep that in mind when reading these topics as a refresher on how to secure your Cisco devices.

  • Read the information presented in this chapter, paying special attention to tables, Notes, and Exam Alerts.

  • Complete the Challenge and the Exercises at the end of the chapter. The exercises will solidify the concepts that you have learned in the previous sections.

  • Complete the Exam Questions at the end of the chapter. They are designed to simulate the types of questions you will be asked on the ICND1 exam.

</feature>

Introduction

Securing a network is an endless task. Every day there are new scripts and exploits, new vulnerabilities, and new methods to gain access to your network. Our job as Cisco administrators is to stay ahead of the game as much as possible and make it as difficult as possible to gain access.

As discussed in Chapter 4, “General Network Security,” the basis of any good security implementation is a thorough security policy. Switched networks must be a pivotal piece of that security policy; however, they are typically the most overlooked. The fact that the LAN is tucked away inside your network provides a false sense of security, especially because some of your biggest threats might be the users attached to the switched network. This chapter examines how to secure access to the Cisco devices in your LAN as well as the traffic that flows through it.

Securing Physical Access to the Catalyst Switch

Similar to troubleshooting, our first layer of defense for securing the switched network should start at the Physical layer. Specifically, we need to secure access to the physical switch itself and the cables that are connected to it. It doesn’t take a skilled attacker to physically destroy a switched network to which he or she has complete access.

With that being said, the first and probably most critical step of securing your network is to ensure that the switches themselves are secured in a cool room in which only you or those authorized have access. If users have physical access to the switches, they can easily console into the switch and perform a password-recovery exercise (easily found on the Internet) just by repowering the switch and holding down a button during power-up. Even unintentional attacks such as custodial staff unplugging your switches to run the vacuum can occur easily if not secured correctly. If you can, also make sure that the Ethernet cabling between the switches and end devices is not in plain sight and therefore can’t be easily damaged. You don’t want the last act by a fired employee to be taking down your entire network by ripping out your existing wiring.

Securing Terminal Access to the Catalyst Switch

After we have ensured that the switch is physically secured, the next layer of defense to implement is securing terminal access to the switch so that attackers cannot perform reconnaissance or manipulate configurations. Because there are several ways to gain access to the Cisco IOS, due diligence is required to ensure that all terminal connections are secured.

To start, the first logical terminal access to secure is the console and auxiliary port. Many might ask why, because we already physically secured the switch. To answer a question with a question, would you have an account at a bank that leaves your money out on a table because they have an alert security guard standing at the door? A layered defensive approach entails having security measures at each step of the way so that attackers will have many obstacles in their way in achieving their objective.

To secure access to the console and aux port, the simplest defense you can use is securing them with a password. Just as in router configurations, this is achieved in the line configuration using the password command. It is also a good idea to make sure that your passwords are strong passwords containing at least eight characters and that they have a combination of numbers, symbols, and lower and uppercase letters:

Switch(config)# line console 0
Switch(config-line)# login
Switch(config-line)# password EggsAmKr@m
Switch(config-line)# exit
Switch(config)# line auxiliary 0
Switch(config-line)# login
Switch(config-line)# password EggsAmPr3p

What’s more, you can create a local username and password combination that is stored in the configuration. This username and password will be required to be entered when someone attaches to the console and gets an EXEC prompt. The only difference in the configuration is that you no longer need to specify a password in the line configuration, because you achieved that in defining the username and password combination, and you also must use the keyword local in the login command. This keyword tells the IOS to use the local username and password combination that can be found in the configuration:

Switch(config)# username jchambers password Sysco-Prez
Switch(config)# line console 0
Switch(config-line)# login local
Switch(config-line)# exit
Switch(config)# line auxiliary 0
Switch(config-line)# login local

Now, when someone attaches to the console or aux port, he or she is prompted for a username and password, such as the following:

Press RETURN to get started.
User Access Verification

Username:jchambers
Password:
Switch>

Note

If you configure the console and aux login to use the username and password using the login local command and a password configuration is present on the line as well, the IOS uses the username and password over the password line configuration.

Tip

You can use a special username and password command that encrypts the password similarly to the enable secret command. Conveniently enough, the command is username username secret password. This applies an MD5 hash of the password so that it cannot be easily acquired if the configuration is accessed.

To Telnet or Not to Telnet

Recall that although Telnet is a convenient way to gain EXEC access to the Cisco device, it also is extremely dangerous, because everything that is sent using Telnet is in clear text and can be intercepted by anyone eavesdropping on the session. With that being said, whenever possible, use SSH for remote terminal connectivity to the Cisco device. Recall that the configuration for enabling SSH on a Cisco device is as follows:

  1. Change the default hostname of the Cisco device.

  2. Configure a domain name with the ip domain-name command.

  3. Generate the RSA key with at least a 1024-bit key with the crypto key generate rsa command.

  4. Create a username and password.

A recommended third step in this process, however, is to limit the vty lines on the Cisco device to accept only SSH as an input protocol. In other words, this step entails disallowing Telnet into the vty lines. The command to limit the terminal input on the vty lines is transport input SSH on the vty line configuration:

Switch(config)# line vty 0 15
Switch(config-line)# transport input SSH

When you exclude the keyword telnet in the transport input command, only SSH is allowed as a terminal input protocol on all the vty lines.

Whether you are using SSH or are only left with using Telnet, make sure you have properly secured user EXEC access through the vty lines using the same methods as the aux and console. Specifically, configure a password on the vty lines or use the login local command to prompt for a username and password.

Exam Alert

By using the transport input SSH command, you limit SSH as the only transport protocol allowed on the vty lines

Additional IOS Security Practices

In addition to securing access to Cisco IOS, it is also a good idea to secure the contents of the configuration using some practical and simple configuration steps that we have discussed. This list is not exhaustive by any means, but it is a good beginning point:

  1. Encrypt your enable password to privileged EXEC using the enable secret command.

  2. Encrypt all other clear-text passwords in the configuration using service password-encryption.

  3. Create a login banner that warns against unauthorized access attempts to the EXEC prompt.

  4. Disable EXEC access on unused terminal access ports (such as aux ports) using the no exec command in the line configuration.

  5. Limit how long the terminal session stays idle to not exceed one minute with the exec-timeout command (exec-timeout 1 0).

Layer 2 Security

Feeling satisfied with securing access to the physical switch and cables as well as access to the Catalyst switch IOS, our next step on our secure ladder is to get to the core of our switching functions and secure the possible vulnerabilities that occur at the Data Link layer.

The transparent functions that our switches perform, such as MAC address learning and forwarding, are taken for granted because they are just that: transparent. Consequently, these are the most overlooked aspects of switch security today, because we naturally assume that the default behavior of the switch’s design is how it should be. Any thought of securing that behavior goes against the switch’s basic operations. In the following sections, you will see that although the extra configuration steps might involve slightly more work, the end result is that you won’t lose sleep wondering when the next attack might cause your cell phone to go off.

Port Security

Objectives:

  • Implement and verify basic security for a switch (port security, deactivate ports)

Anybody who has physical access to the ports of your switches can easily attach another switch or hub to enable more devices to be on the switched network. If you want to limit the number of MAC addresses that can be dynamically learned on a switch port (for environments such as college campuses and hotels), you can enable the port security feature on your switch ports that are accessible to end users. With the switchport port-security commands, you can define the maximum number of MAC addresses to be learned on an access port. If this maximum number is exceeded, the switch port is put in an error-disabled state (by default) in which you have to reenable the interface by administratively shutting it down (with the shutdown command) and reenabling the port with the no shutdown command. Although this is a bit drastic, it is a surefire way to ensure that switch administrators know where the violation occurred and help identify the users who might be responsible.

To configure this port security functionality, you must enable this port security on each interface, followed by the maximum MAC count allowed on the interface (the default is 1). For example, if you wanted to restrict the number of MAC addresses allowed to 10, you would use the following configuration on the port:

Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 10

Furthermore, you can change the default action when a violation occurs on the secured port with the switchport port-security violation command:

Switch(config-if)# switchport port-security violation {protect | restrict | shutdown}

The default action is shutdown, which puts the port in the error-disabled state, as mentioned earlier. You can also choose to have the port increase a violation counter and alert an administrator using an SNMP trap with the restrict keyword. The protect keyword only allows traffic from the secure port; it drops packets from other MAC addresses until the number of MAC addresses drops below the maximum.

Exam Alert

The switchport port-security maximum command restricts how many MAC addresses can be learned on a switch interface. The switchport port-security violation shutdown command instructs the switch to disable the port when a violation occurs.

Static MAC with Port Security

The default state of Cisco Catalyst switches is to learn MAC addresses dynamically. For security purposes, you can assign static MAC addresses to an interface to ensure that a MAC address is recognized on only a specific interface. For instance, if you want to make sure that no one tries to connect to your switch and spoof (falsely assume the identity of) your server’s MAC address of FA23.239B.2349, you could use the following port security command to statically assign that MAC address to the Fast Ethernet 0/2 interface:

Switch(config)# interface fastethernet 0/2
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security mac-address FA23.239B.2349

This configuration leaves the maximum secure MAC address at its default of 1. If the switch receives another MAC address on Fast Ethernet 0/2, or the MAC address FA23.239B.2349 is seen entering a port other than Fast Ethernet 0/2, the port is disabled.

Port security also can save you some configuration by learning sticky secure MAC addresses. With the command switchport port-security mac-address sticky, the switch automatically configures the addresses already dynamically learned on the interface, as well as any new MAC addresses (up to the maximum) to be secure MAC addresses. These sticky addresses actually get added as sticky secure MAC configuration line entries in the running configuration. If you save the configuration and reboot the switch, those secure MAC addresses won’t need to be relearned.

Exam Alert

Sticky addresses are secure MAC addresses that are dynamically learned on the interface.

Verifying Port Security

Objectives:

  • Verify network status and switch operation using basic utilities (including: ping, traceroute, telnet, SSH, arp, ipconfig), SHOW & DEBUG commands

To verify the port security configuration parameters on the interface, as well as the number of security violations that have occurred on that interface, use the show port-security interface interface command:

Switch# show port-security interface fa0/2
Port Security                        : Enabled
Port Status                          : Secure-up
Violation Mode                       : Shutdown
Aging Time                           : 0 mins
Aging Type                           : Absolute
SecureStatic Address Aging           : Disabled
Maximum MAC Addresses                : 1
Total MAC Addresses                  : 1
Configured MAC Addresses             : 1
Sticky MAC Addresses                 : 0
Last Source Address                  : fa23.239b.2349
Security Violation Count             : 0

Based on this output, you can see that port security is enabled and is not in a disabled state. The default actions for violations (shutdown) and maximum MAC addresses are configured on Fast Ethernet 0/2, with a configured MAC address of fa23.239b.2349.

To verify your configured port security addresses, use the show port-security address command:

Switch# show port-security address
          Secure Mac Address Table
-------------------------------------------------------------------
Vlan    Mac Address       Type                Ports   Remaining Age
                                                         (mins)
----    -----------       ----                -----   -------------
   1    fa23.239b.2349    SecureConfigured       Fa0/2       -
-------------------------------------------------------------------
Total Addresses in System (excluding one mac per port)     : 0
Max Addresses limit in System (excluding one mac per port) : 1024

Here you can see that your statically configured secure MAC address is configured on Fast Ethernet 0/2. Compare that output to a dynamically learned sticky MAC address, which shows the type as SecureDynamic as opposed to SecureConfigured:

Switch# show port-security address
          Secure Mac Address Table
-------------------------------------------------------------------
Vlan    Mac Address       Type                Ports   Remaining Age
                                                         (mins)
----    -----------       ----                -----   -------------
   1    fa23.239b.2349    SecureDynamic       Fa0/2       -
-------------------------------------------------------------------
Total Addresses in System (excluding one mac per port)     : 0
Max Addresses limit in System (excluding one mac per port) : 1024

“See”DP

This might sound like Cisco sacrilege, but you should consider disabling CDP on switch interfaces that do not need it, such as edge ports connected to end devices. If you consider the information someone can learn from CDP, you’ll realize the major security liability it can be. From just a single CDP multicast, an attacker could learn the hostname, the local port on the switch that sent the CDP message, and the switch’s IP address. With this information and strong motivation, it is only a matter of time before your switch and its networks are infiltrated.

Recall that to disable CDP on individual interfaces, you must configure no cdp enable on each interface. If you have no need for CDP, disable it globally on the switch with the no cdp run command.

Chapter Summary

Securing a switched network entails trying to protect all Layer 1 aspects of the switch, including access to the IOS itself. In addition, it is imperative to secure the switch’s Layer 2 operations so that an attacker doesn’t interrupt or damage the switched network.

Securing the Physical layer entails ensuring that the switch and its cables are in a secure environment where users cannot inflict damage on them. This step also gives added protection from users gaining console access to the switch to gain information to attack the network or attack or manipulate the switch itself. Leveraging the IOS’s internal security measures such as logins and passwords for terminal access is also ideal in building a layered defense. When possible, it is also recommended that you use SSH instead of Telnet for remote access to the IOS, because the communications between the management computer and the switch are secured.

Data Link layer security involves securing individual ports using port security. Port security protects ports by defining a maximum number of MAC addresses that are allowed to be dynamically learned on an individual port. You can also manually specify the MAC address(es) that are allowed to be present in the source address of the Ethernet frame when entering that port. This can be a single static configured MAC address, or you can configure sticky learning, and the addresses will be dynamically added to the configuration. When a port security violation occurs, the default action is to disable the interface. When this occurs, you have to shut down the interface and administratively bring it back up. You can configure the switch port to just report the violation (restrict), or you can reject frames from nonsecure MAC addresses until the number of MAC addresses falls under the limit (protect).

In addition, CDP reveals potentially dangerous information in its multicasts; thus, it is recommended that you disable CDP globally or on interfaces that do not require it.

Apply Your Knowledge

Exercises

The Impregnable IOS

Now it is time to take the security features you learned about in this chapter and apply them to our switch. To start, we will walk through an exercise of securing access to the IOS and the passwords in the configuration.

Estimated Time: 15 minutes

  1. Console into your switch.

  2. Configure a username and password. If supported, make the password secured with an MD5 hash.

  3. Change the default hostname, and configure a domain name for the switch.

  4. Generate a 1024-bit RSA key.

  5. Configure the console’s login to prompt for the username and password.

  6. Disable the auxiliary port from getting EXEC access.

  7. Configure the login of the vty lines to prompt for a username and password.

  8. Allow SSH only on the vty lines (remove Telnet).

  9. Limit the timeout for EXEC sessions to 45 seconds.

  10. Assign an MD5 hashed enable password.

  11. Encrypt all clear-text passwords.

Your configuration should be similar to the following:

! Step 2
Switch(config)# username artvandelay secret Imp0rt3xp0rt
! Step 3
Switch(config)# ip domain-name examprep.com
Switch(config)# hostname Swtch2950
! Step 4
Swtch2950(config)# crypto key generate rsa
The name for the keys will be: Swtch2950.examprep.com
Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose
The Impregnable IOS Keys. Choosing a key modulus greater than 512 may take a few minutes.


How many bits in the modulus [512]: 1024
Generating RSA keys ...
[OK]
7w1d: %SSH-5-ENABLED: SSH 1.99 has been enabled
! Step 5
Swtch2950(config)# line console 0
Swtch2950(config-line)# login local
Swtch2950(config-line)# exit
! Step 6
Swtch2950(config)# line auxiliary 0
Swtch2950(config-line)# no exec
Swtch2950(config-line)# exit
! Step 7
Swtch2950(config)# line vty 0 15
Swtch2950(config-line)# login local
! Step 8
Swtch2950(config-line)# transport input ssh
! Step 9
Switch(config-line)# exec-timeout 0 45
Switch(config-line)# exit
! Step 10
Swtch2950(config)# enable secret MD5p@ssw0rd
! Step 11
Swtch2950(config)# service password-encryption

Layer 2 Security To-Do

With our switch secured, it is time to secure the switch’s Layer 2 operations.

Estimated Time: 10 minutes

  1. Enable port security on ports 1 through 5 using the interface range command.

  2. Set the maximum number of dynamically learned MAC addresses to 10.

  3. Change the default action of violations to disallow traffic from any newly learned MAC addresses over our maximum.

  4. Configure the sixth interface to have only a single MAC address of 1234.5678.ABCD.

  5. Configure the seventh interface to have secure MAC addresses sticky-learned.

  6. Disable CDP globally.

Your configuration should be similar to the following:

! Step 1
Swtch2950(config)# interface range fastethernet 0/1-5
Swtch2950(config-if)# switchport port-security
! Step 2
Swtch2950(config-if)# switchport port-security maximum 10
! Step 3
Swtch2950(config-if)# switchport port-security violation protect
Swtch2950(config-if)# exit
! Step 4
Swtch2950(config)# interface fastethernet 0/6
Swtch2950(config-if)# switchport port-security mac-address 1234.5678.ABCD
Swtch2950(config-if)# exit
! Step 5
Swtch2950(config)# interface fastethernet 0/7
Swtch2950(config-if)# switchport port-security mac-address sticky
Swtch2950(config-if)# exit
! Step 6
Swtch2950(config)# no cdp run

Review Questions

1.

What is the significance of securing physical access to a switch?

2.

How can you harden (make secure) the Cisco IOS?

3.

How can you ensure that only one specific end device is attached to a switch port?

4.

Why could CDP be a potential security risk?

Exam Questions

1.

Which of the following is not a violation action of port security?

  1. Protect

  1. Shut down

  1. Notify

  1. Restrict

2.

Which of the following is not a recommended security implementation for securing the Catalyst switch?

  1. SSH.

  1. Disable the console port.

  1. Configure the login and password for the vty lines.

  1. Allow only specific management IP address(es) into the vty lines.

3.

Which command produced the following output?

Switch# show port-security address
          Secure Mac Address Table
-------------------------------------------------------------------
Vlan    Mac Address       Type                Ports   Remaining Age
                                                         (mins)
----    -----------       ----                -----   -------------
   1    1234.5678.9ABF    SecureConfigured       Fa0/9       -
-------------------------------------------------------------------
Total Addresses in System (excluding one mac per port)     : 0
Max Addresses limit in System (excluding one mac per port) : 1024

  1. Switch(config-if)# switchport port-security sticky

  1. Switch(config-if)# switchport port-security mac-address 1234.5678.9abf

  1. Switch(config-if)# switchport port-security mac-address sticky

  1. Switch(config-if)# switchport port-security 1234.5678.9abf

4.

Given the following:

Switch# show port-security interface fa0/6
Port Security                        : Enabled
Port Status                          : Err-disabled
Violation Mode                       : Shutdown
Aging Time                           : 0 mins
Aging Type                           : Absolute
SecureStatic Address Aging           : Disabled
Maximum MAC Addresses                : 1
Total MAC Addresses                  : 2
Configured MAC Addresses             : 0
Sticky MAC Addresses                 : 0
Last Source Address                  : fa53.c39b.af34
Security Violation Count             : 1

which of the following is a possible cause of the output?

  1. Fast Ethernet 0/6 is receiving traffic and working correctly.

  1. A static MAC address has been configured on Fast Ethernet 0/6.

  1. Fast Ethernet 0/6 is learning sticky MAC addresses.

  1. Fast Ethernet 0/6 is shut down because a violation has occurred.

5.

Why is the following output false?

Switch# show port-security interface fa0/2
Port Security                        : Enabled
Port Status                          : Secure-up
Violation Mode                       : Shutdown
Aging Time                           : 0 mins
Aging Type                           : Absolute
SecureStatic Address Aging           : Disabled
Maximum MAC Addresses                : 10
Total MAC Addresses                  : 50
Configured MAC Addresses             : 0
Sticky MAC Addresses                 : 0
Last Source Address                  : de26.287b.2490
Security Violation Count             : 0

  1. There are more MAC addresses than the maximum allowed and no violations.

  1. You cannot have the violation action be shutdown unless static secure MAC addresses are configured.

  1. Sticky addresses must be configured if there is more than one MAC address.

  1. The maximum MAC addresses cannot be changed from the default value of 1.

6.

Which of the following is false regarding what happens when you use the login local command on line configurations?

  1. The switch uses the username and password configured from the global configuration.

  1. You are prompted for a login and password as long as you don’t use the password command on the line configuration.

  1. This command can be configured on vty lines, the auxiliary port, and the console port.

  1. The password can be encrypted using the username username secret password command.

Answers to Review Questions

1.

An attacker can maliciously cause physical damage to the switch and/or the cables connected to the switch and ultimately bring down your network. If the attacker wants to covertly attack the network or gain unauthorized access to other devices or networks, he or she can also gain console access to the switch and perform password recovery to reconfigure the switch or discover other devices. For these reasons, it is imperative to ensure that the physical equipment and cables are secured from unauthorized users.

2.

The first step to hardening the Cisco IOS is to secure all points of terminal entry to the IOS. This entails assigning passwords (or usernames/password combinations) to the console, aux, and vty lines. Additionally, if any of these services are not being used, you should disable EXEC access. For remote access, you should use SSH over Telnet if possible and allow SSH only on the vty lines.

After terminal access is secured, you should ensure that all passwords are encrypted in the configuration, disable CDP on interfaces that do not require it, and decrease the amount of time an EXEC session can remain idle.

3.

To ensure that a single device is attached to a switch port, enable port security and allow only one MAC address as the maximum (the default). For additional security, manually or dynamically (using sticky learning) specify the device’s MAC address.

4.

CDP advertises pertinent information for discovery and troubleshooting. Information such as CDP-advertising ports, hostname, and IP addresses can be intercepted and used to attack the switch.

Answers to Exam Questions

1.

C. Notify is not a valid action of port security. The three actions that can be configured are shut down, protect, and restrict.

2.

B. Answer B is not a recommended security implementation because you will always require console access as a failsafe to gain access to Cisco devices. SSH, login/passwords for vty lines, and specifying management IP address(es) of management station(s) are all recommended security implementations.

3.

B. Because the output indicates that the MAC address is SecureConfigured, it must have been manually configured using the switchport port-security mac-address 1234.5678.9abf command. Answers A and D are not valid command syntax for port security. Answer C is valid syntax, but the output for the MAC address would show up as SecureDynamic.

4.

D. The port status of the output indicates that it is an error-disabled state, which means that a violation has occurred and that the default action (shutdown) has disabled the port. Because the maximum MAC addresses is configured as 1, and it has learned two MAC addresses, it is safe to say that this is the cause of the violation. Answer A is incorrect because the port is not in a Secure-Up (active) state. Answer B is incorrect because the count of configured MAC addresses is 0. Answer C is incorrect as well because the output indicates that the sticky MAC address count is also 0.

5.

A. If the number of MAC addresses is exceeded, security violations should increase, and the configured action should take place (in this case, shutdown). Answer B is incorrect because you can have the violation be shutdown on dynamic, sticky-learned, or static MAC addresses. Answer C is incorrect because it is not required (although it might be more practical) to configure sticky addresses when there is more than one secure MAC address. Answer D is incorrect because the maximum MAC addresses can be configured to be more than 1.

6.

B. You will still be prompted for a login and password, regardless of whether a password is configured. The switch uses the local username and password (which can be encrypted using the username username secret password command) and can be assigned to console, aux, and vty lines, so answers A, C, and D are incorrect.

Suggested Readings and Resources

  1. Richard Froom, Balaji Sivasubramanian, and Erum Frahim. Building Cisco Multilayer Switched Networks (BCMSN) (Authorized Self-Study Guide), 4th Edition. Cisco Press, 2007.

  2. Wendell Odom. CCNA ICND2 Official Exam Certification Guide (CCNA Exams 640-816 and 640-802), 2nd Edition. Cisco Press, 2007.

  3. “Port Security,” www.cisco.com.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.252.87