Home > Articles > Cisco Network Technology > General Networking > Cisco ASA Security Contexts

Cisco ASA Security Contexts

  • Sample Chapter is provided courtesy of Cisco Press.
  • Date: Dec 16, 2005.

Chapter Description

The virtual firewall methodology enables a physical firewall to be partitioned into multiple standalone firewalls. Each standalone firewall acts and behaves as an independent entity with its own configuration, interfaces, security policies, routing table, and administrators. In Cisco ASA, these virtual firewalls are known as security contexts. This chapter covers security contexts in detail.

Configuration of Security Contexts

The configuration of a security context is broken down into seven steps:

  1. Enable multiple security contexts globally.
  2. Set up the system execution space.
  3. Specify a configuration URL.
  4. Allocate the interfaces.
  5. Configure an admin context.
  6. Configure a customer context.
  7. Manage the security contexts (optional).

Refer to Figure 9-3 throughout this section to visualize how to configure a virtual firewall.

Step 1: Enabling Multiple Security Contexts Globally

The 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 Context

Chicago# 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.

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 Mode

Chicago# show mode

   Security context mode: multiple

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 Firewall

   Chicago# 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 Space

As 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:

  • Access the security appliance via the console or the auxiliary port.
  • Log into the admin context using SSH or Telnet, and then switch to the system execution space. (The admin context is discussed earlier under the "Architectural Overview" section.

    If you are logged into the admin context, you need to use the changeto system command to get access to the system execution space. Example 9-5 demonstrates how to log into the system from the admin context.

    If you are in a security context, the host name contains a /. The text before the / is the host name of the security appliance, while the text after is the name of the security context. If the host name does not contain a /, you are in the system execution space.

Example 9-5. Switching to System Execution Space

   Chicago/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 Space

Chicago# 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#

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 Context

Chicago(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

Step 3: Specifying a Configuration URL

The 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:

  • A TFTP server, 192.168.10.50, to store the CustA configuration
  • An FTP server, 192.168.20.50, to save the CustB configuration
  • The local disk for the admin context configuration

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 Contexts

Chicago(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.

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:

  1. Log into the security context whose URL is to be changed, and clear the running configuration.
  2. Log into the system execution space and enter into the context configuration mode.
  3. Specify the new configuration URL that you want to use.

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 URL

Chicago# 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 Interfaces

After 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.

Table 9-3. allocate-interface Command Definition

Syntax

Description

physical_interface

Physical interface that is being allocated to a context, such as GigabitEthernet0/0.

subinterface

Subinterface that is being allocated to a context, such as GigabitEthernet0/0.1. A range of subinterfaces can also be specified.

map_name

By default, the allocated interface is displayed as the interface ID in the context. If you want to display the name for an interface instead of the interface ID, you can specify an alphanumeric mapped name. This is extremely useful when you do not want the context administrator to find out which physical interface is being used as the inside or the outside interface. You can also specify a range of mapped names for the corresponding range of subinterfaces.

invisible

If the invisible keyword is configured, the appliance does not display the interface ID in the configuration or the show interface command. This default option only shows the mapped name.

visible

If the visible keyword is configured, the appliance displays the interface ID in the configuration and the show 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 Contexts

Chicago(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

Step 5: Configuring an Admin Context

Cisco 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 Context

Chicago# 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:

  1. The context must be predefined and have a config-url.
  2. The config-url must point to a file in the local disk.

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 Context

Chicago(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:

  • show running-config | include admin-context
  • show admin-context
  • show context, and look for the context name with an asterisk (*)

In Example 9-13, the highlighted entries indicate that CustA is currently set as the admin context.

Example 9-13. Verifying the Admin Context

Chicago# 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 Context

Any 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 Context

Chicago# change to context CustA

   Chicago/CustA#

After logging into the customer context, you can configure all the supported firewall-related options.

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 Context

Chicago(config)# no context CustB
WARNING: Removing context 'CustB'
Proceed with removing the context? [confirm]
Removing context 'CustB' (4)... Done

In 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 Contexts

Chicago(config)# clear configure context
3. Deployment Scenarios | Next Section Previous Section

Cisco Press Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Cisco Press and its family of brands. I can unsubscribe at any time.

Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Cisco Press products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@ciscopress.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children

This site is not directed to children under the age of 13.

Marketing

Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by Cisco Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.ciscopress.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020