ip inspect name inspection-name [parameter max-sessions number] protocol [alert {on | off}] [audit-trail {on | off}] [timeout seconds]
no ip inspect name inspection-name [parameter max-sessions number] protocol [alert {on | off}] [audit-trail {on | off}] [timeout seconds]
HTTP Inspection
Syntax
ip inspect name inspection-name http [java-list access-list] [urlfilter] [alert {on | off}] [audit-trail {on | off}] [timeout seconds]
no ip inspect name inspection-name protocol
Simple Mail Transfer
Protocol (SMTP) and Extended SMTP Inspection (ESMTP) Syntax
ip inspect name inspection-name {smtp | esmtp} [alert {on | off}] [audit-trail {on | off}] [max-data number] [timeout seconds]
remote-procedure call (RPC)
Inspection Syntax
ip inspect name inspection-name [parameter max-sessions number] rpc program-number number [wait-time minutes] [alert {on | off}] [audit-trail {on | off}] [timeout seconds]
no ip inspect name inspection-name protocol
Post Office Protocol
3(POP3)/ Internet Message Access Protocol(IMAP) Inspection Syntax
ip inspect name inspection-name imap [alert {on | off}] [audit-trail {on | off}] [reset] [secure-login] [timeout number]
ip inspect name inspection-name pop3 [alert {on | off}] [audit-trail {on | off}] [reset] [secure-login] [timeout number]
Fragment Inspection
Syntax
ip inspect name inspection-name [parameter max-sessions number] fragment [max number timeout seconds]
no ip inspect name inspection-name [parameter max-sessions number] fragment [max number timeout seconds]
Application Firewall
Provisioning Syntax
ip inspect name inspection-name [parameter max-sessions number] appfw policy-name
no ip inspect name inspection-name [parameter max-sessions number] appfw policy-name
User-Defined Application
Syntax
ip inspect inspection-name user-10 [alert {on | off}] [audit-trail {on | off}] [timeout seconds]
noip inspect inspection-name user-10 [alert {on | off}] [audit-trail {on | off}] [timeout seconds]
Session Limiting
Syntax
no ip inspect name inspection-name [parameter max-sessions number]
Usage Guidelines
To define a set
of inspection rules, enter the
ip
inspect
name command for each protocol that you want the
Cisco IOS firewall to inspect, using the same
inspection-name . Give each set of inspection rules
a unique
inspection-name , which should not exceed the
16-character length limit. Define either one or two sets of rules per
interface--you can define one set to examine both inbound and outbound traffic,
or you can define two sets: one for outbound traffic and one for inbound
traffic. The
no
ip
inspect-name
protocol
removes the inspection rule for the specified protocol.
no
ip
inspect
name
command removes the entire set of inspection rules.
To define a
single set of inspection rules, configure inspection for all the desired
application-layer protocols, and for ICMP, TCP, and UDP, or as desired. This
combination of TCP, UDP, and application-layer protocols join together to form
a single set of inspection rules with a unique name. (There are no
application-layer protocols associated with ICMP.)
To remove the
inspection rule for a protocol, use the
no form of
this command with the specified inspection name and protocol; To remove the
entire set of inspection rules, use the
no form of
this command only; that is, do not list any inspection names or protocols.
In general, when
inspection is configured for a protocol, return traffic entering the internal
network will be permitted only if the packets are part of a valid, existing
session for which state information is being maintained.
Table 2. Protocol
Keywords--Transport-Layer and Network-Layer Protocols
Protocol
|
Keyword
|
ICMP
|
icmp
|
TCP
|
tcp
|
UDP
|
udp
|
Note
|
The TCP, UDP,
and H.323 protocols support the
router-traffic keyword, which enables inspection
of traffic destined to or originated from a router. The command format is as
follows:
ip
inspect
name
inspection-nam e {tcp |
udp |
H323 } [alert {on |
off }] [audit-trail {on |
off }] [router-traffic ][timeout
seconds ]
|
TCP and UDP
Inspection
You can configure
TCP and UDP inspection to permit TCP and UDP packets to enter the internal
network through the firewall, even if the application-layer protocol is not
configured to be inspected. However, TCP and UDP inspection do not recognize
application-specific commands, and therefore might not permit all return
packets for an application, particularly if the return packets have a different
port number from the previous exiting packet.
Any
application-layer protocol that is inspected will take precedence over the TCP
or UDP packet inspection. For example, if inspection is configured for FTP, all
control channel information will be recorded in the state table, and all FTP
traffic will be permitted back through the firewall if the control channel
information is valid for the state of the FTP session. The fact that TCP
inspection is configured is irrelevant.
With TCP and UDP
inspection, packets entering the network must exactly match an existing
session. The entering packets must have the same source or destination
addresses and source or destination port numbers as the exiting packet (but
reversed). Otherwise, the entering packets will be blocked at the interface.
Granular protocol
inspection allows you to specify TCP or UDP ports by using the
port-to-application mapping (PAM) table. This eliminates having to inspect all
applications running under TCP or UDP and the need for multiple ACLs to filter
the traffic.
Using the PAM
table, you can pick an existing application or define a new one for inspection,
thereby simplifying Access Control List (ACL) configuration.
ICMP
Inspection
ICMP inspection
sessions are done on the basis of the source address of the inside host that
originates the ICMP packet. Dynamic ACLs are created for return ICMP packets of
the allowed types (echo-reply,destination unreachable, time-exceeded, and
timestamp reply) for each session. No port numbers associated with an ICMP
session, and the permitted IP address of the return packet is a wild-card in
the ACL. The wildcard address is because the IP address of the return packet
cannot be known in advance for time-exceeded and destination-unreachable
replies. These replies can come from intermediate devices rather than the
intended destination.
Application-Layer Protocol Inspection
In general, if
you configure inspection for an application-layer protocol, packets for that
protocol should be permitted to exit the firewall (by configuring the correct
ACL), and packets for that protocol will be allowed back in through the
firewall only if they belong to a valid existing session. Each protocol packet
is inspected to maintain information about the session state.
Java, H.323, RPC,
SIP, and SMTP inspection have additional information, described in the next
five sections. The table below lists the supported application-layer protocols.
Table 3. Protocol
Keywords--Application-Layer Protocols
Protocol
|
Keyword
|
Application Firewall
|
appfw
|
CU-SeeMe
|
cuseeme
|
ESMTP
|
smtp
|
FTP
|
ftp
|
IMAP
|
imap
|
Java
|
http
|
H.323
|
h323
|
Microsoft
NetShow
|
netshow
|
POP3
|
pop3
|
RealAudio
|
realaudio
|
RPC
|
rpc
|
SIP
|
sip
|
Simple
Mail Transfer Protocol (SMTP)
|
smtp
|
Skinny
Client Control Protocol (SCCP)
|
skinny
|
StreamWorks
|
streamworks
|
Structured Query Language*Net (SQL*Net)
|
sqlnet
|
TFTP
|
tftp
|
UNIX R
commands (rlogin, rexec, rsh)
|
rcmd
|
VDOLive
|
vdolive
|
WORD
|
user-defined
application
name
;
use
prefix
-user
Note
|
All
applications that appear under the
show
ip
port-map command are supported.
|
|
Java
Inspection
Java inspection
enables Java applet filtering at the firewall. Java applet filtering
distinguishes between trusted and untrusted applets by relying on a list of
external sites that you designate as "friendly." If an applet is from a
friendly site, the firewall allows the applet through. If the applet is not
from a friendly site, the applet will be blocked. Alternately, you could permit
applets from all sites except sites specifically designated as "hostile."
Note
|
Before you
configure Java inspection, you must configure a numbered standard access list
that defines "friendly" and "hostile" external sites. You configure this
numbered standard access list to permit traffic from friendly sites, and to
deny traffic from hostile sites. If you do not configure a numbered standard
access list, but use a "placeholder" access list in the
ip
inspect
name
inspection-name
http command,
all Java applets will be blocked.
|
Note
|
Java blocking
forces a strict order on TCP packets. To properly verify that Java applets are
not in the response, a firewall will drop any TCP packet that is out of order.
Because the network--not the firewall--determines how packets are routed, the
firewall cannot control the order of the packets; the firewall can only drop
and retransmit all TCP packets that are not in order.
|
Caution
|
Context-Based
Access Control (CBAC) does not detect or block encapsulated Java applets.
Therefore, Java applets that are wrapped or encapsulated, such as applets in
.zip or .jar format, are
not blocked
at the firewall. CBAC also does not detect or block applets loaded via FTP,
gopher, or HTTP on a nonstandard port.
|
H.323
Inspection
If you want CBAC
inspection to work with NetMeeting 2.0 traffic (an H.323 application-layer
protocol), you must also configure inspection for TCP, as described in the
chapter "Configuring Context-Based Access Control" in the Cisco IOS Security
Configuration Guide . This requirement exists because NetMeeting 2.0 uses
an additional TCP channel not defined in the H.323 specification.
RPC
Inspection
RPC inspection
allows the specification of various program numbers. You can define multiple
program numbers by creating multiple entries for RPC inspection, each with a
different program number. If a program number is specified, all traffic for
that program number will be permitted. If a program number is not specified,
all traffic for that program number will be blocked. For example, if you
created an RPC entry with the NFS program number, all NFS traffic will be
allowed through the firewall.
SIP
Inspection
You can configure
SIP inspection to permit media sessions associated with SIP-signaled calls to
traverse the firewall. Because SIP is frequently used to signal both incoming
and outgoing calls, it is often necessary to configure SIP inspection in both
directions on a firewall (both from the protected internal network and from the
external network). Because inspection of traffic from the external network is
not done with most protocols, it may be necessary to create an additional
inspection rule to cause only SIP inspection to be performed on traffic coming
from the external network.
SMTP
Inspection
SMTP inspection
causes SMTP commands to be inspected for illegal commands. Packets with illegal
commands are modified to a "xxxx" pattern and forwarded to the server. This
process causes the server to send a negative reply, forcing the client to issue
a valid command. An illegal SMTP command is any command except the following:
-
DATA
-
HELO
-
HELP
-
MAIL
-
NOOP
-
QUIT
-
RCPT
-
RSET
-
SAML
-
SEND
-
SOML
-
VRFY
ESMTP
Inspection
Like SMTP, ESMTP
inspection also causes the commands to be inspected for illegal commands.
Packets with illegal commands are modified to a "xxxx" pattern and forwarded to
the server. This process causes the server to send a negative reply, forcing
the client to issue a valid command. An illegal ESMTP command is any command
except the following:
-
AUTH
-
DATA
-
EHLO
-
ETRN
-
HELO
-
HELP
-
MAIL
-
NOOP
-
QUIT
-
RCPT
-
RSET
-
SAML
-
SEND
-
SOML
-
VRFY
In addition to
inspecting commands, the ESMTP firewall also inspects the following extensions
via deeper command inspection:
-
Message Size
Declaration (SIZE)
-
Remote Queue
Processing Declaration (ETRN)
-
Binary MIME
(BINARYMIME)
-
Command
Pipelining
-
Authentication
-
Delivery
Status Notification (DSN)
-
Enhanced
Status Code (ENHANCEDSTATUSCODE)
-
8bit-MIMEtransport (8BITMIME)
Note
|
SMTP and ESMTP
cannot exist simultaneously. An attempt to configure both protocols will result
in an error message.
|
Use of the
urlfilter Keyword
If you specify
the
urlfilter
keyword, the Cisco IOS Firewall will interact with a URL filtering software to
control web traffic for a given host or user on the basis of a specified
security policy.
Note
|
Enabling HTTP
inspection with or without any option triggers the Java applet scanner, which
is CPU intensive. The only way to stop the Java applet scanner is to specify
the
java-list
access-list
option. Configuring URL filtering without enabling the
java-list
access-list option will severely impact
performance.
|
Use of the
timeout
Keyword
If you specify a
timeout for any of the transport-layer or application-layer protocols, the
timeout will override the global idle timeout for the interface to which the
set of inspection rules is applied.
If the protocol
is TCP or a TCP application-layer protocol, the timeout will override the
global TCP idle timeout. If the protocol is UDP or a UDP application-layer
protocol, the timeout will override the global UDP idle timeout.
If you do not
specify a timeout for a protocol, the timeout value applied to a new session of
that protocol will be taken from the corresponding TCP or UDP global timeout
value valid at the time of session creation.
The default ICMP
timeout is deliberately short (10 seconds) due to the security hole that is
opened by allowing ICMP packets with a wild-card source address back into the
inside network. The timeout will occur 10 seconds after the last outgoing
packet from the originating host. For example, if you send a set of 10 ping
packets spaced one second apart, the timeout will expire in 20 seconds or 10
seconds after the last outgoing packet. However, the timeout is not extended
for return packets. If a return packet is not seen within the timeout window,
the gap will be closed and the return packet will not be allowed in. Although
the default timeout can be made longer if desired, it is recommended that this
value be kept relatively short.
IP
Fragmentation Inspection
CBAC inspection
rules can help protect hosts against certain denial-of-service attacks
involving fragmented IP packets. Even though the firewall keeps an attacker
from making actual connections to a given host, the attacker may still be able
to disrupt services provided by that host. This is done by sending many
noninitial IP fragments or by sending complete fragmented packets through a
router with an ACL that filters the first fragment of a fragmented packet.
These fragments can tie up resources on the target host as it tries to
reassemble the incomplete packets.
Using
fragmentation inspection, the firewall maintains an
interfragment
state (structure) for IP traffic. Noninitial
fragments are discarded unless the corresponding initial fragment was permitted
to pass through the firewall. Noninitial fragments received before the
corresponding initial fragments are discarded.
Note
|
Fragmentation
inspection can have undesirable effects in certain cases, because it can result
in the firewall discarding any packet whose fragments arrive out of order.
There are many circumstances that can cause out-of-order delivery of legitimate
fragments. Apply fragmentation inspection in situations where legitimate
fragments, which are likely to arrive out of order, might have a severe
performance impact.
|
Because routers
running Cisco IOS software are used in a very large variety of networks, and
because the CBAC feature is often used to isolate parts of internal networks
from one another, the fragmentation inspection feature is not enabled by
default. Fragmentation detection must be explicitly enabled for an inspection
rule using the
ip
inspect
name command. Unfragmented traffic is never
discarded because it lacks a fragment state. Even when the system is under
heavy attack with fragmented packets, legitimate fragmented traffic, if any,
will still get some fraction of the firewall’s fragment state resources, and
legitimate, unfragmented traffic can flow through the firewall unimpeded.
Application
Firewall Provisioning
Application
firewall provisioning allows you to configure your Cisco IOS Firewall to detect
and prohibit a specific protocol type of traffic.
Most firewalls
provide packet filtering capabilities that simply permit or deny traffic
without inspecting the data stream; the Cisco IOS application firewall can
detect whether a packet is in compliance with a given HTTP protocol. If the
packet is determined to be unauthorized, it will be dropped, the connection
will be reset, and a syslog message will be generated, as appropriate.
User-Defined
Applications
You can define
your own applications and enter them into the PAM table using the
ip
port-map command. Then you set up your inspection
rules by inserting your user-defined application as a value for the
protocol
argument in the
ip
inspect
name command.
Session
Limiting
Users can limit
the number of established firewall sessions that a firewall rule creates by
setting the "max-sessions" threshold. A session counter is maintained for each
firewall interface. When a session count exceeds the specified threshold, an
alert FW-4-SESSION_THRESHOLD_EXCEEDED message is logged to the syslog server
and no new sessions can be created.
Examples
The following
example causes the software to inspect TCP sessions and UDP sessions, and to
specifically allow CU-SeeMe, FTP, and RPC traffic back through the firewall for
existing sessions only. For UDP traffic, audit-trail is on. For FTP traffic,
the idle timeout is set to override the global TCP idle timeout. For RPC
traffic, program numbers 100003, 100005, and 100021 are permitted.
ip inspect name myrules tcp
ip inspect name myrules udp audit-trail on
ip inspect name myrules cuseeme
ip inspect name myrules ftp timeout 120
ip inspect name myrules rpc program-number 100003
ip inspect name myrules rpc program-number 100005
ip inspect name myrules rpc program-number 100021
The following
example adds fragment checking to software inspection of TCP and UDP sessions
for the rule named
"myrules ." In
this example, the firewall software will allocate 100 state structures, and the
timeout value for dropping unassembled packets is set to 4 seconds. If 100
initial fragments for 100 different packets are sent through the router, all of
the state structures will be used up. The initial fragment for packet 101 will
be dropped. Additionally, if the number of free state structures (structures
available for use by unassembled packets) drops below the threshold values, 32
or 16, the timeout value is automatically reduced to 2 or 1, respectively.
Changing the timeout value frees up packet state structures more quickly.
ip inspect name myrules tcp
ip inspect name myrules udp audit-trail on
ip inspect name myrules cuseeme
ip inspect name myrules ftp timeout 120
ip inspect name myrules rpc program-number 100003
ip inspect name myrules rpc program-number 100005
ip inspect name myrules rpc program-number 100021
ip inspect name myrules fragment max 100 timeout 4
The following
firewall and SIP example shows how to allow outside-initiated calls and
internal calls. For outside-initiated calls, an ACL needs to be accessed to
allow for the traffic from the initial signaling packet from outside.
Subsequent signaling and media channels will be allowed by the inspection
module.
ip inspect name voip sip
interface FastEthernet0/0
ip inspect voip in
!
!
interface FastEthernet0/1
ip inspect voip in
ip access-group 100 in
!
!
access-list 100 permit udp host <gw ip> any eq 5060
access-list 100 permit udp host <proxy ip> any eq 5060
access-list deny ip any any
The following
example shows two configured inspections named fw_only and fw_urlf; URL
filtering will work only on the traffic that is inspected by fw_urlf. Note that
the
java-list
access-list option has been enabled, which disables
java scanning.
ip inspect name fw_only http java-list 51 timeout 30
interface e0
ip inspect fw_only in
!
ip inspect name fw_urlf http java-list 51 urlfilter timeout 30
interface e1
ip inspect fw_urlf in
The following
example shows how to define the HTTP application firewall policy mypolicy. This
policy includes all supported HTTP policy rules. This example also includes
sample output from the
show
appfw
configuration and
show
ip
inspect
config commands, which allow you to verify the
configured setting for the application policy.
! Define the HTTP policy.
appfw policy-name mypolicy
application http
strict-http action allow alarm
content-length maximum 1 action allow alarm
content-type-verification match-req-rsp action allow alarm
max-header-length request 1 response 1 action allow alarm
max-uri-length 1 action allow alarm
port-misuse default action allow alarm
request-method rfc default action allow alarm
request-method extension default action allow alarm
transfer-encoding type default action allow alarm
!
!
! Apply the policy to an inspection rule.
ip inspect name firewall appfw mypolicy
ip inspect name firewall http
!
!
! Apply the inspection rule to all HTTP traffic entering the FastEthernet0/0 interface.
interface FastEthernet0/0
ip inspect firewall in
!
!
! Issue the show appfw configuration
command and the show ip inspect config
command after the inspection rule "mypolicy" is applied to all incoming HTTP traffic on the FastEthernet0/0 interface.
!
Router# show appfw configuration
Application Firewall Rule configuration
Application Policy name mypolicy
Application http
strict-http action allow alarm
content-length minimum 0 maximum 1 action allow alarm
content-type-verification match-req-rsp action allow alarm
max-header-length request length 1 response length 1 action allow alarm
max-uri-length 1 action allow alarm
port-misuse default action allow alarm
request-method rfc default action allow alarm
request-method extension default action allow alarm
transfer-encoding default action allow alarm
Router# show ip inspect config
Session audit trail is disabled
Session alert is enabled
one-minute (sampling period) thresholds are [400:500] connections
max-incomplete sessions thresholds are [400:500]
max-incomplete tcp connections per host is 50. Block-time 0 minute.
tcp synwait-time is 30 sec -- tcp finwait-time is 5 sec
tcp idle-time is 3600 sec -- udp idle-time is 30 sec
dns-timeout is 5 sec
Inspection Rule Configuration
Inspection name firewall
http alert is on audit-trail is off timeout 3600