21.01.2015 Views

Lab 6.2 Configuring CBAC

Lab 6.2 Configuring CBAC

Lab 6.2 Configuring CBAC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Lab</strong> <strong>6.2</strong> <strong>Configuring</strong> <strong>CBAC</strong><br />

Learning Objectives<br />

• Configure <strong>CBAC</strong> rules on a router<br />

• Apply <strong>CBAC</strong> rules on a router<br />

Topology Diagram<br />

Scenario<br />

Context-based access control (<strong>CBAC</strong>) is a powerful tool in the Cisco IOS<br />

Firewall feature set. It allows stateful packet inspection of certain types of<br />

attacks. In this lab, INSIDE represents an inside corporate router, OUTSIDE<br />

represents an outside Internet or ISP router, and FW represents the corporate<br />

firewall. <strong>CBAC</strong> alone is not enough to make a router into a secure Internet<br />

firewall, but in addition to other security features it can be a very powerful<br />

defense.<br />

Step 1: Configure the Physical Interfaces<br />

Configure the loopback interfaces with the addresses shown in the topology<br />

diagram. Also configure the serial interfaces shown in the diagram. Set the<br />

clock rate on the appropriate interface and issue the no shutdown command<br />

on all serial connections. Verify that you have connectivity across the local<br />

subnet using the ping command.<br />

INSIDE(config)# interface serial0/0/0<br />

INSIDE(config-if)# ip address 172.16.12.1 255.255.255.0<br />

INSIDE(config-if)# clockrate 64000<br />

1 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


INSIDE(config-if)# no shutdown<br />

FW(config)# interface serial0/0/0<br />

FW(config-if)# ip address 172.16.12.2 255.255.255.0<br />

FW(config-if)# no shutdown<br />

FW(config-if)# interface serial0/0/1<br />

FW(config-if)# ip address 192.168.23.2 255.255.255.0<br />

FW(config-if)# clockrate 64000<br />

FW(config-if)# no shutdown<br />

OUTSIDE(config)# interface serial0/0/1<br />

OUTSIDE(config-if)# ip address 192.168.23.3 255.255.255.0<br />

OUTSIDE(config-if)# no shutdown<br />

Step 2: Configure Static Default Routes<br />

On the INSIDE and OUTSIDE routers, configure static default routes directing<br />

traffic to unknown destinations to be forwarded to the FW router. FW will not<br />

need any routes because it has interfaces directly connected to both networks<br />

(as shown in the topology diagram.)<br />

INSIDE(config)# ip route 0.0.0.0 0.0.0.0 172.16.12.2<br />

OUTSIDE(config)# ip route 0.0.0.0 0.0.0.0 192.168.23.2<br />

Your network should have full IP connectivity at this point. If it does not have full<br />

connectivity, troubleshoot.<br />

Normally, a single-homed company might use Network Address Translation<br />

(NAT) at its corporate edge to protect its network and allow private addressing<br />

within the bounds of its network. In that case, the OUTSIDE router, normally a<br />

provider edge router would have a static route directing traffic to the address<br />

owned by the customer out one of its interfaces. In this scenario you will not<br />

configure NAT, and you will use a default route for simplicity.<br />

Step 3: Enable Telnet Access<br />

You will be using the Telnet protocol to test connectivity in this lab scenario. In<br />

order to enable Telnet access on a router beginning with its default<br />

configuration, simply apply the password string command on the virtual<br />

terminal lines.<br />

Apply this configuration change on the INSIDE and OUTSIDE routers. Use<br />

“cisco” as the line password. This will be used later for verification purposes.<br />

INSIDE(config)# line vty 0 4<br />

INSIDE(config-line)# password cisco<br />

INSIDE(config-line)# login<br />

OUTSIDE(config)# line vty 0 4<br />

OUTSIDE(config-line)# password cisco<br />

OUTSIDE(config-line)# login<br />

2 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


Step 4: Create IP Inspect Rules<br />

<strong>CBAC</strong> operates by statefully inspecting some protocols and tracking TCP<br />

connections and UDP flows. <strong>CBAC</strong> examines the protocols to determine if<br />

incoming, untrusted (outside) traffic is return traffic for an inside-initiated<br />

connection, or the result of arbitrarily spoofed packets. For some well-known<br />

protocols, <strong>CBAC</strong> can also examine particular application-layer fields to make<br />

sure that the packets are following the protocols of those specific applications<br />

correctly. Any traffic that is not accepted by <strong>CBAC</strong> is treated appropriately<br />

according to the rules indicated by the access list on the interface. This is done<br />

by explicitly blocking untrusted traffic (which we will configure later) except<br />

when allowed by <strong>CBAC</strong>.<br />

Why is it important to keep track of connection states, especially with TCP<br />

connections<br />

The critical part of configuring <strong>CBAC</strong> involves creating rules to track<br />

connections and flows. Create rules to track TCP and UDP flows using the ip<br />

inspect name name protocol command. Use the name “myrules” and apply the<br />

<strong>CBAC</strong> rule to the to Serial0/0/0 interface in the inbound direction. To see the<br />

protocols available (most of the protocols listed will be application layer<br />

protocols), enter the ip inspect name name command followed by the <br />

character. Newer IOS versions will have more protocols listed.<br />

FW(config)# ip inspect name myrules <br />

802-11-iapp IEEE 802.11 WLANs WG IAPP<br />

ace-svr<br />

ACE Server/Propagation<br />

aol<br />

America-Online<br />

appfw<br />

Application Firewall<br />

appleqtc<br />

Apple QuickTime<br />

bgp<br />

Border Gateway Protocol<br />

<br />

FW(config)# ip inspect name myrules tcp<br />

FW(config)# ip inspect name myrules udp<br />

You can also set <strong>CBAC</strong> timeouts for various protocols. To change the amount<br />

of time that should pass before a UDP flow times out, use the ip inspect udp<br />

idle-time timeout command in global configuration mode. The default UDP idle<br />

timeout is 30 seconds. Change the UDP timeout to 60 seconds.<br />

FW(config)# ip inspect udp idle-time 60<br />

3 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


Why is this particularly important for UDP protocols<br />

On a per-protocol basis, there are other adjustable settings. For instance, you<br />

can manipulate <strong>CBAC</strong> to trigger logging messages based on the matched<br />

protocol. This is important for security accounting as well as for debugging<br />

purposes. View the options available on a per-protocol basis, using the <br />

character.<br />

FW(config)# ip inspect name myrules tcp <br />

alert<br />

Turn on/off alert<br />

audit-trail Turn on/off audit trail<br />

router-traffic Enable inspection of sessions to/from the router<br />

timeout<br />

Specify the inactivity timeout time<br />

<br />

In a secure network, you would likely set up a Syslog server to monitor security<br />

information including communication to external networks. Alert and audit trail<br />

messages allow holes in the firewall created by <strong>CBAC</strong> to be monitored and<br />

logged for later use. By default, <strong>CBAC</strong> logs alert messages to the console<br />

which can be configured on a per-protocol basis to override the global settings<br />

for the alert messages (as shown above). To change the global setting for<br />

alerts, use the command ip inspect alert-off. By default, alerts are on. To<br />

enable audit-trail messages, use the global command ip inspect audit-trail. By<br />

default, audit-trail messages are off. The timeout argument specifies a perprotocol<br />

connection timeout period. Add in Internet Control Message Protocol<br />

(ICMP) with a timeout time of 5 seconds, HTTP inspection without alerting, and<br />

FTP inspection with an audit-trail. ICMP inspection may not work on older IOS<br />

releases.<br />

FW(config)# ip inspect name myrules icmp timeout 5<br />

FW(config)# ip inspect name myrules http alert off<br />

FW(config)# ip inspect name myrules ftp audit-trail on<br />

To apply the rule set to an interface, use the interface level command ip<br />

inspect name direction. Apply “myrules” to the inside interface on FW with an<br />

inbound direction. This means that any traffic initiated from the inside interface<br />

going through the router will have IP inspection performed on it.<br />

FW(config)# interface serial0/0/0<br />

FW(config-if)# ip inspect myrules in<br />

In this scenario, you could also apply it outbound on the outside interface to<br />

achieve the same effect. When would this not apply<br />

4 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


Step 5: Block Unwanted Outside Traffic<br />

Configure an extended access list to deny any traffic coming in the outside<br />

interface. The access list must be extended because <strong>CBAC</strong> needs to open up<br />

temporary holes in it for return traffic and cannot do this with standard access<br />

lists. Also have the deny portion of the access-list log packets that are blocked.<br />

Apply this access list to be inbound on the outside interface on the firewall.<br />

NOTE: If you are using an older IOS release that did not accept ICMP<br />

inspection earlier, you may want to add the statement access-list 100 permit<br />

icmp any any before the deny statement in this access list to allow all ICMP<br />

traffic to go through (since it will not be inspected by <strong>CBAC</strong>).<br />

FW(config)# access-list 100 deny ip any any log<br />

FW(config)# interface serial0/0/1<br />

FW(config-if)# ip access-group 100 in<br />

Step 6: Verify <strong>CBAC</strong> Operation<br />

Telnet from OUTSIDE to INSIDE. This should fail.<br />

OUTSIDE# telnet 172.16.12.1<br />

Trying 172.16.12.1 ...<br />

% Destination unreachable; gateway or host down<br />

OUTSIDE#<br />

In addition, you should see a log message appear on FW. This log message is<br />

not from <strong>CBAC</strong> but instead from the access list denying the packet.<br />

FW#<br />

*Feb 18 02:11:11.823: %SEC-6-IPACCESSLOGP: list 100 denied tcp 192.168.23.3(0)<br />

-> 172.16.12.1(0), 1 packet<br />

Now, attempt to telnet from INSIDE to OUTSIDE. Leave the telnet session open<br />

so you can verify the connection on FW.<br />

INSIDE# telnet 192.168.23.3<br />

Trying 192.168.23.3 ... Open<br />

User Access Verification<br />

Password:<br />

OUTSIDE><br />

On FW, issue the show ip inspect all command to see the configuration and<br />

operation of <strong>CBAC</strong>. Notice the inspected TCP connection between INSIDE and<br />

OUTSIDE is listed at the end.<br />

FW# show ip inspect all<br />

Session audit trail is disabled<br />

Session alert is enabled<br />

one-minute (sampling period) thresholds are [400:500] connections<br />

max-incomplete sessions thresholds are [400:500]<br />

5 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


max-incomplete tcp connections per host is 50. Block-time 0 minute.<br />

tcp synwait-time is 30 sec -- tcp finwait-time is 5 sec<br />

tcp idle-time is 3600 sec -- udp idle-time is 30 sec<br />

dns-timeout is 5 sec<br />

Inspection Rule Configuration<br />

Inspection name myrules<br />

tcp alert is on audit-trail is off timeout 3600<br />

udp alert is on audit-trail is off timeout 30<br />

icmp alert is on audit-trail is off timeout 5<br />

http alert is off audit-trail is off timeout 3600<br />

ftp alert is on audit-trail is on timeout 3600<br />

Interface Configuration<br />

Interface Serial0/0/0<br />

Inbound inspection rule is myrules<br />

tcp alert is on audit-trail is off timeout 3600<br />

udp alert is on audit-trail is off timeout 30<br />

icmp alert is on audit-trail is off timeout 5<br />

http alert is off audit-trail is off timeout 3600<br />

ftp alert is on audit-trail is on timeout 3600<br />

Outgoing inspection rule is not set<br />

Inbound access list is not set<br />

Outgoing access list is not set<br />

Established Sessions<br />

Session 458348C4 (172.16.12.1:54736)=>(192.168.23.3:23) tcp SIS_OPEN<br />

View detailed session information by issuing the show ip inspect detail<br />

command on FW.<br />

FW# show ip inspect sessions detail<br />

Established Sessions<br />

Session 458348C4 (172.16.12.1:54736)=>(192.168.23.3:23) tcp SIS_OPEN<br />

Created 00:03:25, Last heard 00:03:23<br />

Bytes sent (initiator:responder) [37:79]<br />

In SID 192.168.23.3[23:23]=>172.16.12.1[54736:54736] on ACL 100 (11<br />

matches)<br />

Close the telnet connection when you are done verifying <strong>CBAC</strong> operation.<br />

OUTSIDE> exit<br />

[Connection to 192.168.23.3 closed by foreign host]<br />

INSIDE#<br />

Note: If your Cisco IOS release does not support ICMP inspection, skip the<br />

following verification step since ICMP traffic will not be inspected.<br />

Enable debugging of IP inspection for ICMP traffic using the debug ip inspect<br />

protocol command. In a production environment, debugging <strong>CBAC</strong> is not<br />

recommended because of the high amounts of output it can generate.<br />

FW# debug ip inspect icmp<br />

INSPECT ICMP Inspection debugging is on<br />

From the INSIDE router, ping OUTSIDE. Note that this would not work if you try<br />

to ping the other way because it would be denied by the access list. If<br />

6 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


attempted, the denied packets from OUTSIDE to INSIDE would be logged to<br />

FW’s console line as well.<br />

INSIDE# ping 192.168.23.3<br />

Type escape sequence to abort.<br />

Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds:<br />

!!!!!<br />

Success rate is 100 percent (5/5), round-trip min/avg/max = 56/56/60 ms<br />

FW#<br />

*Feb 18 02:23:29.591: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.591: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.591: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.619: <strong>CBAC</strong>: ICMP Echo Reply pkt 192.168.23.3 => 172.16.12.1<br />

*Feb 18 02:23:29.647: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.675: <strong>CBAC</strong>: ICMP Echo Reply pkt 192.168.23.3 => 172.16.12.1<br />

*Feb 18 02:23:29.703: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.735: <strong>CBAC</strong>: ICMP Echo Reply pkt 192.168.23.3 => 172.16.12.1<br />

*Feb 18 02:23:29.763: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.791: <strong>CBAC</strong>: ICMP Echo Reply pkt 192.168.23.3 => 172.16.12.1<br />

*Feb 18 02:23:29.819: <strong>CBAC</strong>: ICMP Echo pkt 172.16.12.1 => 192.168.23.3<br />

*Feb 18 02:23:29.847: <strong>CBAC</strong>: ICMP Echo Reply pkt 192.168.23.3 => 172.16.12.1<br />

FW# undebug all<br />

Final Configurations<br />

INSIDE# show run<br />

hostname INSIDE<br />

!<br />

interface Serial0/0/0<br />

ip address 172.16.12.1 255.255.255.0<br />

clock rate 64000<br />

no shutdown<br />

!<br />

ip route 0.0.0.0 0.0.0.0 172.16.12.2<br />

!<br />

line vty 0 4<br />

password cisco<br />

login<br />

end<br />

FW# show run<br />

hostname FW<br />

!<br />

ip inspect name myrules tcp<br />

ip inspect name myrules udp<br />

ip inspect name myrules icmp timeout 5<br />

ip inspect name myrules http alert off<br />

ip inspect name myrules ftp audit-trail on<br />

ip inspect udp idle-time 60<br />

!<br />

interface Serial0/0/0<br />

ip address 172.16.12.2 255.255.255.0<br />

ip inspect myrules in<br />

no shutdown<br />

!<br />

interface Serial0/0/1<br />

ip address 192.168.23.2 255.255.255.0<br />

ip access-group 100 in<br />

clock rate 64000<br />

no shutdown<br />

7 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc


!<br />

access-list 100 deny<br />

end<br />

ip any any log<br />

OUTSIDE# show run<br />

hostname OUTSIDE<br />

!<br />

interface Serial0/0/1<br />

ip address 192.168.23.3 255.255.255.0<br />

no shutdown<br />

!<br />

ip route 0.0.0.0 0.0.0.0 192.168.23.2<br />

!<br />

line vty 0 4<br />

password cisco<br />

login<br />

end<br />

8 - 8 CCNP: Implementing Secure Converged Wide-area Networks v5.0 - <strong>Lab</strong> 6-2 Copyright © 2007, Cisco Systems, Inc

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!