{"id":186,"date":"2015-06-23T06:54:19","date_gmt":"2015-06-23T06:54:19","guid":{"rendered":"http:\/\/www.balajibandi.com\/blog\/?p=186"},"modified":"2017-02-05T17:55:44","modified_gmt":"2017-02-05T17:55:44","slug":"using-the-cisco-routers-local-database-to-apply-different-policies-for-cisco-ios-anyconnect-users-part1","status":"publish","type":"post","link":"https:\/\/www.balajibandi.com\/?p=186","title":{"rendered":"Using the Cisco Router\u2019s Local Database to Apply Different Policies for Cisco IOS AnyConnect Users (part1)"},"content":{"rendered":"<p>The title for this article is quite long but it is for a reason: I was faced with this situation some time ago and, after typing in this search term in Google, I could not get a definitive answer. Somehow though, I was able to figure it out and this article will document my solution with the hope that it will help someone else.<\/p>\n<p>When it comes to providing network access to a user (e.g., via a remote access VPN like AnyConnect VPN), it is usually beneficial to be able to apply different policies to different users. For example, a sales staff should only be able to access the sales network subnet, but an administrator should have full access to the network.<\/p>\n<p>Applying different policies to users is mostly achieved by downloading the policies from external AAA servers; however, there are times when it is desirable to be able to configure and apply these policies locally on the device terminating the VPN tunnel.<\/p>\n<p>On the Cisco ASA, this is very easy to achieve because different group policies can be configured and these policies can then be attached to usernames configured on the Cisco ASA. On Cisco routers, however, things are not as clear-cut.<\/p>\n<p>In this article, I will show you one of the ways by which we can apply different policies to WebVPN\/AnyConnect users by relying solely on the local database of the Cisco router terminating the VPN tunnel. In summary, there will be no RADIUS or TACACS+ involved.<\/p>\n<p><strong>IOS WebVPN Group Lock<\/strong><\/p>\n<p>On the Cisco IOS, the group lock feature provides a way to \u201clock down\u201d a particular (EzVPN) group so that only certain users can connect to that group. For example, in the configuration snippet below, only \u2018user1@GROUP1\u2032 will be able to connect to GROUP1 because group lock is enabled on that group; however, both \u2018user1@GROUP1\u2032 and \u2018user2@GROUP2\u2032 can connect to GROUP2 because group lock is not enabled under that group.<\/p>\n<div class=\"EnlighterJSWrapper gitEnlighterJSWrapper\">\n<ol class=\"gitEnlighterJS EnlighterJS\">\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">username user1@GROUP1 password 0 cisco1<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">username user2@GROUP2 password 0 cisco2<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">crypto isakmp client configuration group GROUP1<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> key cisco<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> pool POOL<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> group-lock<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> save-password<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">crypto isakmp client configuration group GROUP2<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> key cisco<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> pool POOL<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> save-password<\/span><\/li>\n<\/ol>\n<\/div>\n<p><strong>Note<\/strong>: The IOS EzVPN group lock is a bit different from the group lock feature on the Cisco ASA where a user is tied to a particular tunnel group; i.e., that user cannot connect to any other tunnel group. On the Cisco IOS, we can say it is the group that is locked; not necessarily the user.<\/p>\n<p>The concept of group lock on the Cisco IOS can be extended to WebVPN. For WebVPN, we use authentication domains to tie a user to a particular WebVPN context. So, in essence, the IOS WebVPN group lock feature is similar to the group lock feature on the Cisco ASA.<\/p>\n<p>You may be wondering how all of this is relevant to applying different policies to users. Well, if we can lock a user to a particular WebVPN context, it means that user will be subject to the policy defined under that context. To use our previous example again, we can create two WebVPN contexts \u2013 Sales and Administrator \u2013 with different policies and then configure the Sales staff with an authentication domain of \u201cSales\u201d and the Administrator with an authentication domain of \u201cAdministrator.\u201d<\/p>\n<p>Let me use the following lab setup to show you how it works:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/1rtdn21e2k8w27koup1eiasxspe.wpengine.netdna-cdn.com\/wp-content\/uploads\/061815_0051_UsingtheCis1.png\" alt=\"\" data-lazy-loaded=\"true\" \/><\/p>\n<p>The configuration on the router is as follows:<\/p>\n<div class=\"EnlighterJSWrapper gitEnlighterJSWrapper\">\n<ol class=\"gitEnlighterJS EnlighterJS\">\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">aaa new-model<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">aaa authentication login webvpn local<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">crypto pki trustpoint TP-self-signed-4279256517<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> enrollment selfsigned<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> subject-name cn=IOS-Self-Signed-Certificate-4279256517<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> revocation-check none<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> rsakeypair TP-self-signed-4279256517<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">username user1@Sales secret cisco<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">username user2@Administrator secret cisco<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">interface FastEthernet0\/0<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> ip address 41.1.1.2 255.255.255.0<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">interface FastEthernet0\/1<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> ip address 192.168.10.1 255.255.255.0<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">interface Virtual-Template1<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> ip unnumbered FastEthernet0\/1<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">ip local pool ANYCONNECT_POOL 192.168.10.51 192.168.10.60<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">ip http server<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">ip http secure-server<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">ip access-list standard SPLIT_ACL<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> permit 192.168.10.0 0.0.0.255<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">ip access-list extended Administrator_ACL<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> permit ip any any<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">ip access-list extended Sales_ACL<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> permit tcp any host 192.168.10.100 eq 80<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">webvpn gateway AnyConnect_RTR<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> ip address 41.1.1.2 port 443<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> ssl trustpoint TP-self-signed-4279256517<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> inservice<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> !<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">webvpn install svc disk0:\/webvpn\/anyconnect-linux-3.1.08009-k9.pkg sequence 1<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> !<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">webvpn context Sales<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> ssl authenticate verify all<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> !<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> policy group Sales_Policy<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> functions svc-enabled<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> filter tunnel Sales_ACL<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> svc address-pool &#8220;ANYCONNECT_POOL&#8221;<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> svc keep-client-installed<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> svc split include 192.168.10.0 255.255.255.0<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> !<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> virtual-template 1<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> default-group-policy Sales_Policy<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> aaa authentication list webvpn<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> aaa authentication domain @Sales<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> gateway AnyConnect_RTR domain Sales<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> inservice<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\">!<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\">webvpn context Administrator<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> ssl authenticate verify all<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> !<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> policy group Administrator_Policy<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> functions svc-enabled<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> filter tunnel Administrator_ACL<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> svc address-pool &#8220;ANYCONNECT_POOL&#8221;<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> svc keep-client-installed<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> svc split include 192.168.10.0 255.255.255.0<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> !<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> virtual-template 1<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> default-group-policy Administrator_Policy<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> aaa authentication list webvpn<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> aaa authentication domain @Administrator<\/span><\/li>\n<li class=\"odd hoverEnabled\"><span class=\"unknown\"> gateway AnyConnect_RTR domain Administrator<\/span><\/li>\n<li class=\"even hoverEnabled\"><span class=\"unknown\"> inservice<\/span><\/li>\n<\/ol>\n<\/div>\n<p>The only difference between the WebVPN contexts in our configuration are the tunnel filters that are applied: the \u201cSales\u201d context has the \u201cSales_ACL\u201d applied, which only allows HTTP to host 192.168.10.100 while the \u201cAdministrator\u201d context has the \u2018Administrator_ACL\u2019 applied, which permits all traffic.<\/p>\n<p>The first thing we need to note is that the way users access the WebVPN service is now different. Without authentication domains configured, a user just needs to go to https:\/\/&lt;webvpn-server-ip-address&gt;\/ (or http:\/\/ if HTTP port redirection is enabled) to access the WebVPN service. However, with authentication domains, the user has to specify the context he\/she is connecting to.<\/p>\n<p>Therefore, user1 will go to https:\/\/41.1.1.2\/Sales while user2 will go to<a href=\"https:\/\/41.1.1.2\/Administrator\">https:\/\/41.1.1.2\/Administrator<\/a>. The same thing applies if users are connecting via the AnyConnect client \u2013 instead of just specifying the IP address or hostname of the WebVPN server, they must also specify the context.<\/p>\n<p>For testing purposes, I already have the AnyConnect client installed on my laptop so I will use this to connect.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/1rtdn21e2k8w27koup1eiasxspe.wpengine.netdna-cdn.com\/wp-content\/uploads\/061815_0051_UsingtheCis2.png\" alt=\"\" data-lazy-loaded=\"true\" \/><\/p>\n<p>When the user enters his\/her username, the domain through which the user connects is attached in the form of <a href=\"mailto:username@domain\">username@domain<\/a> and this is what is authenticated against the defined AAA authentication method list (in our case \u2018webvpn\u2019 which uses local database). Therefore, in the screenshot above, \u201c<a href=\"mailto:user1@Sales\">user1@Sales<\/a>\u201d is the value sent to the local DB of the router for authentication. That is the reason we configured our usernames in that format.<\/p>\n<p>After successful authentication, users connected to the Sales context should only be able to open HTTP to 192.168.10.100, so let\u2019s test this.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/1rtdn21e2k8w27koup1eiasxspe.wpengine.netdna-cdn.com\/wp-content\/uploads\/061815_0051_UsingtheCis3.png\" alt=\"\" data-lazy-loaded=\"true\" \/><\/p>\n<p>As you can see, the HTTP connection to 192.168.10.100 goes through but the ping doesn\u2019t. Now I will disconnect and connect to the Administrator context using \u2018user2\u2032.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/1rtdn21e2k8w27koup1eiasxspe.wpengine.netdna-cdn.com\/wp-content\/uploads\/061815_0051_UsingtheCis4.png\" alt=\"\" data-lazy-loaded=\"true\" \/><\/p>\n<p>This user should have unrestricted access so both ping and HTTP should work.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/1rtdn21e2k8w27koup1eiasxspe.wpengine.netdna-cdn.com\/wp-content\/uploads\/061815_0051_UsingtheCis5.png\" alt=\"\" data-lazy-loaded=\"true\" \/><\/p>\n<p>If I run the command <strong><em>debug webvpn aaa<\/em><\/strong>, we can confirm that user1 cannot access the Administrator context (and user2 cannot access the Sales context). If user1 tries to access the Administrator context, <a href=\"mailto:'user1@Administrator\">\u201cuser1@Administrator<\/a>\u201d will be sent for authentication, which does not match any configured username so the authentication fails.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/1rtdn21e2k8w27koup1eiasxspe.wpengine.netdna-cdn.com\/wp-content\/uploads\/061815_0051_UsingtheCis6.png\" alt=\"\" data-lazy-loaded=\"true\" \/><\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>In this article, we have covered one of the ways\u2014the group lock feature\u2014by which we can apply different policies to WebVPN\/AnyConnect VPN users by using the local database of the terminating router.<\/p>\n<p>In the next article, I will show you another method which I feel is better. I hope you have found this article helpful.<\/p>\n<p><strong>References and Further Reading<\/strong><\/p>\n<ul>\n<li>ASA and Cisco IOS Group-lock Features and AAA Attributes and WebVPN Configuration Example:http:\/\/www.cisco.com\/c\/en\/us\/support\/docs\/security\/ios-easy-vpn\/117634-configure-asa-00.html<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The title for this article is quite long but it is for a reason: I was faced with this situation some time ago and, after typing in this search term in Google, I could not get a definitive answer. Somehow though, I was able to figure it out and this article will document my solution [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,2],"tags":[],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-ccie-sec","category-cisco"],"_links":{"self":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=186"}],"version-history":[{"count":1,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/186\/revisions"}],"predecessor-version":[{"id":187,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/186\/revisions\/187"}],"wp:attachment":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}