|
|
< Day Day Up > |
|
Configuration of Security ContextsThe configuration of a security context is broken down into seven steps:
Refer to Figure 9-3 throughout this section to visualize how to configure a virtual firewall. Step 1: Enabling Multiple Security Contexts GloballyThe security context can be enabled by using the mode multiple command, as shown in Example 9-2. When this command is executed, the security appliance prompts the system administrator to verify mode conversion before proceeding further. This initiates the reboot process to complete mode conversion. Example 9-2. Enabling Security ContextChicago# configure terminal Chicago(config)# mode ? multiple Multiple mode; mode with security contexts single Single mode; mode without security contexts Chicago(config)# mode multiple WARNING: This command will change the behavior of the device WARNING: This command will initiate a Reboot Proceed with change mode? [confirm] Convert the system configuration? [confirm] The old running configuration file will be written to disk0 The admin context configuration will be written to disk0 The new running configuration file was written to disk0 Security context mode: multiple *** *** --- SHUTDOWN NOW --- *** *** Message to all terminals: *** *** change mode Rebooting.... Booting system, please wait... ! Output omitted for brevity. INFO: Context admin was created with URL disk0:/admin.cfg INFO: Admin context will take some time to come up .... please wait. Chicago> When multiple-mode conversion is initiated, the security appliance prompts the administrator to convert the current running configuration into the system execution space and admin context. The appliance stores the system execution space in NVRAM and saves the admin context in the local Flash memory as admin.cfg. During conversion, it copies all the network-related information to the admin.cfg file, while all the device-related system information is stored in the NVRAM space. Note The security appliance saves the running configuration of the single-mode firewall as old_running.cfg in the Flash memory during the conversion process. Once the appliance comes online, you can use show mode to verify whether it is running in multiple mode. Example 9-3 shows the output of show mode. Example 9-3. Verifying Virtual Firewall ModeChicago# show mode Security context mode: multiple Note If you do not have the license for multiple security contexts, the system key still lets you configure two customer contexts, in addition to one admin context. Refer to Chapter 4, "Initial Setup and System Maintenance," for more information about licensing. To convert the device back to single mode, you have to copy the saved old_running.cfg as the startup configuration. After that, you need to switch the security appliance to single mode. Both of these steps are shown in Example 9-4. Example 9-4. Reverting to Single-Mode FirewallChicago# copy disk0:/old_running.cfg startup-config Source filename [old_running.cfg]? Copy in progress...C 1465 bytes copied in 0.250 secs Chicago# configure terminal Chicago(config)# mode single WARNING: This command will change the behavior of the device WARNING: This command will initiate a Reboot Proceed with change mode? [confirm] Security context mode: single *** *** --- SHUTDOWN NOW --- *** *** Message to all terminals: *** *** change mode Rebooting.... Step 2: Setting Up the System Execution SpaceAs mentioned earlier, the system execution space is created as soon as multiple mode is enabled. To access the system execution space, you can do either of the following:
Note The system execution space can also be accessed through the GUI of ASA Device Manager (ASDM). Consult Chapter 19, "Firewall Management Using ASDM," for more information. Example 9-5. Switching to System Execution SpaceChicago/admin# changeto system
Chicago#The purpose of system execution space is to define the admin and customer contexts on the appliance. A context can be added by using the context command followed by the name of the context. Example 9-6 shows how to add CustA and CustB security contexts in the Chicago ASA. The security context name is case sensitive, so double-check it when adding the contexts. The appliance takes you into the context subconfiguration mode (config-ctx) to configure the necessary parameters. Example 9-6. Adding Customer Contexts in System Execution SpaceChicago# configure terminal Chicago(config)# context CustA Creating context 'CustA'... Done. (2) Chicago(config-ctx)# exit Chicago(config)# context CustB Creating context 'CustB'... Done. (3) Chicago(config-ctx)# end Chicago# Note The security appliance will not allow a system administrator to change to the newly created context until it is initialized, as discussed next in "Step 3: Specifying a Configuration URL." The Cisco appliance allows you to add a description to the configured contexts. It is recommended that you add a description under each context for references purposes, as illustrated in Example 9-7. Example 9-7. Configuring a Description on the Security ContextChicago(config)# context CustA Chicago(config-ctx)# description Customer A's Security Context Chicago(config-ctx)# context CustB Chicago(config-ctx)# description Customer B's Security Context Caution If you issue the clear configure all command from the system configuration, the Cisco ASA removes all security contexts from the device. Step 3: Specifying a Configuration URLThe configuration URL specifies the location of the startup configuration for each context. The configured contexts (either admin or customer) are not active unless there is a configuration URL. The supported storage locations include the local disk and a network drive using the HTTP, HTTPS, FTP, or TFTP protocol. Once a configuration URL is specified, the Cisco ASA tries to retrieve the configuration from that location. If it does not find the configuration file, the Cisco security appliance creates a configuration file with the default settings. An administrator can choose to specify different external servers as the configuration URL location for the security contexts. As shown in Figure 9-3, the Chicago ASA has an admin and two customer contexts. The system administrator prefers to use the following:
By default, these configuration files are saved in the root directory of the network protocol used by the context. For example, if the root directory of an FTP server is C:\FTP\files, the configuration URL using the FTP protocol will save the configuration file at that location. The security appliance saves the configuration of these security contexts when either write memory or copy running-config startup-config is issued from within the security context. Example 9-8 shows the relevant configuration to define configuration URL. Example 9-8. Setting config-url for Security ContextsChicago(config)# context admin Chicago(config-ctx)# config-url disk0:/admin.cfg Chicago(config-ctx)# context CustA Chicago(config-ctx)# config-url tftp://192.168.10.50/CustA.cfg Chicago(config-ctx)# context CustB Chicago(config-ctx)# config-url ftp://cisco:cisco123@192.168.20.50/CustB.cfg For the FTP protocol, you have to specify a username and a password to save and retrieve the configuration file. In the previous example, the CustB context is set up to use cisco as the username and cisco123 as the password. Note You cannot change the location of the configuration URL from within a context. You have to be in the system execution space to accomplish this. When the configuration URL is changed, the appliance merges the running configuration of a context with the new configuration specified in the URL. This may add unnecessary commands and may cause system instability. If you do not want to merge the two configurations, you can follow these guidelines:
As soon as the new URL is entered, the appliance loads the new configuration immediately in the running configuration. Example 9-9 shows how the security appliance in Chicago can be configured to use a new configuration URL. The CustA context is currently using a TFTP server to retrieve the startup configuration; however, the administrator wants to use an FTP server instead. Example 9-9. Changing the Configuration URLChicago# change context CustA Chicago/CustA# configure terminal Chicago/CustA(config)# clear configure all Chicago/CustA(config)# changeto system Chicago(config)# context CustA Chicago(config-ctx)# config-url ftp://cisco:cisco123@192.168.10.50/CustA.cfg Step 4: Allocating the InterfacesAfter defining the configuration URL, the next step is to allocate interfaces to each of the security contexts. You can assign either a physical interface or a subinterface to a security context. Do this by entering into the context subconfiguration mode and using the allocate-interface command: allocate-interface physical_interface [map_name][visible | invisible] allocate-interface physical_interface.subinterface[ -physical_interface. subinterface] [map_name[ -map_name]][visible | invisible] The allocate-interface command can hide the physical interface name from the security context if a mapped name is used. This provides additional security by displaying only the mapped name to the context administrator. Table 9-3 lists and defines the arguments used in the allocate-interface command.
In Example 9-10, the ASA in Chicago is configured to allocate GigabitEthernet0/0 and GigabitEthernet0/1 to CustA and are mapped as A_inside and A_outside, respectively. The invisible option is used at the end to hide the physical interface name when the context administrator looks at the interface configuration or statistics. The appliance is also set up to allocate GigabitEthernet0/2 and GigabitEthernet0/3 to CustB. The context administrators will see these interfaces as B_inside and B_outside. Example 9-10. Allocating Interfaces to Security ContextsChicago(config)# context CustA Chicago(config-ctx)# allocate-interface GigabitEthernet0/0 A_inside invisible Chicago(config-ctx)# allocate-interface GigabitEthernet0/1 A_outside invisible Chicago(config-ctx)# exit Chicago(config)# context CustB Chicago(config-ctx)# allocate-interface GigabitEthernet0/2 B_inside invisible Chicago(config-ctx)# allocate-interface GigabitEthernet0/3 B_outside invisible Note If the appliance is converted from a single- to multiple-mode firewall, it allocates all the non-shutdown interfaces to the admin context. It is highly recommended that you use the admin context only for management purposes. Reallocate the interfaces to the proper contexts if necessary. Step 5: Configuring an Admin ContextCisco ASA creates an admin context automatically, if you convert it from single to multiple mode and you answer "yes" to "Convert the system configuration?" The admin context is treated as any other customer context in the security appliance. To log into the admin context, use the changeto context command, as shown in Example 9-11, where an administrator logs into admin context called admin. Example 9-11. Logging into a Security ContextChicago# changeto context admin
Chicago/admin#If you would rather designate a different context as the admin context, use the following command in the system execution space: admin-context context_name where context_name is the name of the context you want to designate as the admin context. Before a context is declared to be an admin context, it must meet two requirements:
Example 9-12 shows how to designate CustA as the admin context in a security appliance. Because CustA used a TFTP server to store the startup configuration, the administrator is modifying it to use the local disk0 before setting up the admin-context command. Example 9-12. Setting Up an Admin ContextChicago(config)# context CustA Chicago(config-ctx)# config-url disk0:/CustA.cfg Chicago(config-ctx)# exit Chicago(config)# admin-context CustA Not sure which context is set up as the admin context? Use one of the following three methods to find out:
In Example 9-13, the highlighted entries indicate that CustA is currently set as the admin context. Example 9-13. Verifying the Admin ContextChicago# show running-config | include admin-context admin-context CustA Chicago# show admin-context Admin: CustA disk0/:CustA.cfg Chicago# show context Context Name Interfaces URL admin Management0/0 disk0:/admin.cfg *CustA GigabitEthernet0/0, disk0:/CustA.cfg GigabitEthernet0/1 CustB GigabitEthernet0/2, ftp://cisco:cisco123@192.168.20.50/CustB.cfg GigabitEthernet0/3 Step 6: Configuring a Customer ContextAny context that is not set up as the admin context is referred to as the customer context. As mentioned earlier in this chapter, a customer context is configured similarly to a standalone firewall, with a few exceptions that are listed in Table 9-1. When an administrator logs into a customer context, the command prompt displays the name of that context, as shown in Example 9-14. Example 9-14. Logging Into a Security ContextChicago# change to context CustA Chicago/CustA# After logging into the customer context, you can configure all the supported firewall-related options. Note The security appliance does not save the configuration of all security contexts if copy running-config startup-config is executed from the system execution space. If the security appliance needs to be reloaded, log into all the security contexts to save configuration. Step 7: Managing the Security Contexts (Optional)Cisco ASA provides many ways to manage and optimize system resources. For example, if a context name is mistyped or if it needs to be deleted, you can remove it by typing no context followed by the name of that context. In Example 9-15, the administrator of the Chicago ASA does not want to use CustB as a customer context anymore; instead, the administrator wants to remove it from system configuration. By deleting any unused security context, you do not waste security contexts, which are restricted by the system license. Additionally, the system does not have to allocate CPU and memory resources to maintain the unused contexts. Example 9-15. Removing a Security ContextChicago(config)# no context CustB
WARNING: Removing context 'CustB'
Proceed with removing the context? [confirm]
Removing context 'CustB' (4)... DoneIn a situation where all contexts need to be removed, you can use the clear configure context command, as shown in Example 9-16. Example 9-16. Removing All Security ContextsChicago(config)# clear configure contextCaution The clear configure context command also removes the designated admin context. If you are remotely logged into the appliance over a telnet or a SSH session, you will lose connectivity to the security appliance. |
|
|
< Day Day Up > |
|