Lock-and-Key Feature
The lock-and-key feature uses dynamic access lists to create specific temporary openings in the network in response to a user authentication success. Chapter 8, "Router Security," briefly discusses the usage of a dynamic access list; this chapter contains more detail.Lock-and-key is a traffic-filtering security feature that dynamically filters IP protocol traffic to grant access per user to a specific source/destination host. Lock-and-key is configured using IP dynamic extended access lists. It is the dynamic functionality that makes this feature so interesting. Access lists are typically created and maintained by manually defining the lists and then distributing or deploying them to all other devices in the network. This feature can be used in conjunction with other standard access lists and static extended access lists. It is recommended to use the lock-and-key feature in combination with a AAA server (either TACACS+ or RADIUS) to provide authentication, authorization, and accounting services. Although the lock-and-key is server independent, it is ideally designed for the TACACS+ server. TACACS+ has three components to provide authentication, authorization, and accounting services: protocol support within access servers and routers, protocol specification, and a centralized security database.The following example, which includes Figures 11-7 and 11-8 as well as sample configurations, demonstrates the advantages of having the TACACS+ server in combination with the lock-and-key feature.
Figure 11-7. Dynamic Access List
[View full size image]

Figure 11-8. User Definitions on TACACS+ Server
[View full size image]

Then you can define an extended access list that is applied when a user (any user) logs in to the router and the access-enable command is issued. The name "salesmanagers" is used as a reference for the access list.
line vty 0 4
login local
autocommand access-enable host timeout 10
A second access list needs to block everything except the ability to use FTP to access FileServer1.
access-list 101 dynamic salesmanagers permit ip any any
After applying the access list to the interface on which users are coming in, the lock-and-key feature is activated.
access-list 101 permit tcp any host 144.2.2.2 eq ftp
If users now use Telnet to access the router, they must provide their usernames and passwords to open the hole:
interface FastEthernet0/0
ip access-group 101 in
When you use the show access-lists command, the access list looks like this before any user has used Telnet to reach the router:
C:\>telnet 142.2.65.6
Trying 142.2.65.6 ... Open
User Access Verification
Username: Gert
Password:
[Connection to 142.2.65.6 closed by foreign host]
C:\>
Now take a look at the access list again after the user Gert used Telnet to reach Router1 from 140.6.6.6:
Router1#show access-lists
Extended IP access list 101
Dynamic salesmanagers permit ip any any
permit tcp any host 144.2.2.2 eq ftp
Router1#
A hole has been created in the access list, and users should now be able to have complete IP access to any destination IP address from their source address. In this case, the hole is created for accessing FileServer1 with IP address 144.2.2.2.The temporary entry is removed after a specified idle timeout or absolute timeout period configured by the system manager. Depending on the template defined by the network administrator, the new lock-and-key access lists can be configured to authenticate a single user or multiple users and devices on a remote LAN.
Router1#show access-list
Extended IP access list 101
Dynamic salesmanagers permit ip any any
permit ip host 144.2.2.2 any (4 matches) (time left 586)
permit tcp any host 144.2.2.2 eq ftp (40 matches)
Router1#