Sie sind auf Seite 1von 4

ISSATitle | Article

Article The Author


Global Voice of Information Security ISSA Journal | June 2008

Living with Access Lists


By Jeffrey Monaco

The access control list has been with us since the early days of networking. This article is
about living with them and managing them on a day-to-day basis.

T
he access control list (ACL) has been with us since IP access lists, 100 to 199 indicate “extended” IP access lists,
the early days of networking. ACLs secure many of and so on. This was convenient, but limiting and not very
the world’s networks. You find them in routers, fire- informative. The next step in the evolution of ACLs was the
walls, load-balancers and other internetworking devices. introduction of “named” access lists. It would seem obvious,
They are ubiquitous. If you do a quick search on Google, you but the first rule of Good ACL Management is “Always use
will find hundreds or thousands of links describing the syn- named access lists.”
tax and methods for writing ACLs and making them do what Old-style access lists still occur in a variety of situations. Do
you want. not use them! A name means so much more. Over time, his-
This article is not about writing ACLs but about living with tory teaches a few things about creating the name. Again,
them and managing them on a day-to-day basis. The goal these would seem obvious, but based on experience, they are
is improving the quality of network security, taking it to a not.
higher level. The following are just a few results of improving Long, descriptive names are good. Short, cryptic names are
a network’s ACLs: bad. Which of these two names is more meaningful:
• Provide an audit trail for your security organization Protect_me or
• Enhance the security and availability of your network Limit_telnet_access_to_the_router_2008-03-12?
by reducing or eliminating mistakes
The above example also illustrates another point. Always put
• Recover from mistakes, when they do occur, quicker a date-stamp in the access list name. Access lists, like com-
and easier puter program code, evolve and change over time. Knowing
• Demonstrate a mature and concerned attitude toward when an ACL was created or changed is also part of Good
your work and your employer ACL Management. As will be seen later, the date-stamp also
plays a role in following the golden rule.
ACLs do more than just protect your networks. They also
play an important role in traffic management. For example, You may consider having actual naming conventions for ACL
they control routing decisions in policy-based routing, mark names. Different conventions may be used for different pur-
traffic for quality-of-service processing, control routing up- poses. A workable convention for interface ACLs is “direc-
dates, and control route redistribution between routing pro- tion” + “date-stamp” + “Interface.” An example is:
tocols. Proper handling of ACLs will improve your networks IB080315-serial0/0
in many ways and allow you to follow the golden rule: This immediately identifies the ACL as applied inbound to se-
Always be able to dig yourself out of a hole faster than you dug rial0/0, and was created on 15 March 2008. However, while
yourself into it. naming conventions are good, it is best not to get carried
away. Keep your naming conventions simple; do not try to
The examples that follow are simple in order to illustrate
assign a meaning to every single character of the name. A
methodologies, but be assured they represent real-world situ-
convention should be meaningful, yet easy to use.
ations.
This is an example of a named access list used for controlling
Use named ACLs wherever possible route redistribution. Its function is clearly obvious from the
name. Its date-stamp indicates when it was created.
In the early days of the IOS, ACLs were always based on num-
bers. A certain numeric range indicated a certain type of ip access-list standard limit_routes_we_learn_
ACL. For example, ACLs from 1 to 99 indicate “standard” from_Peoria_2008-03-12
permit 10.10.10.0
 The examples shown in this treatise are oriented toward a Cisco™ environment. permit 10.200.254.17
However, many other networking equipment vendors have similar capabilities and deny any
syntax. The concepts and methods apply to a wide range of environments.

34
Living with Access Lists | Jeffrey Monaco ISSA Journal | June 2008

Use remarks liberally Poor name


An access list is very much like a computer program. Each Router eigrp 100 distribute-list 88 in fa0/1
line is an instruction to be interpreted by the computer. In <snip>
this case, the computer is the router, switch, firewall, or other
security device. Just like a computer program, the lines of the
Never change an active ACL on-the-fly
access list should be commented. Various IOS flavors now This rule, perhaps, will cause the most wailing and gnashing
support the capability to add comments to your code. In the of teeth among network and security engineers. There are a
networking environment, you can use the “remark” state- number of ways to modify an active ACL on-the-fly. Do not
ment. The second rule of Good ACL Management is “Use use them! The next rule of Good ACL Management is, “Al-
remarks in your ACLs.” While this should also be obvious, ways create a new ACL, and switch to it.” Why not modify an
it is clear from experience that most network and security existing ACL on-the-fly? After all, it is quick, easy, and conve-
engineers do a poor job of documenting their ACLs. nient. However, it also leaves no audit trail. The IOS does not
allow the addition of remarks (except in limited instances),
There should be one or more remarks at the beginning of an
and the back-off mechanism is poor and clumsy. It becomes a
access list indicating the purpose of the access list, who cre-
nightmare to back off certain parts of the changed ACL after
ated it, and when it was created. Significant changes to the ac-
several iterations of changes.
cess list should also be documented here. This does not have
to be a novella, but it does need to have enough information Instead, create a new access list from a copy of the ACL that
so that other engineers working with the access list can do so requires modification. Give it a new date-stamp to make it
successfully. It might look like this: unique. You may then switch to it, and, more importantly,
switch back to the old one, with ease. This is the key to being
ip access-list extended Control_WEP_wireless_ able to dig yourself out of a hole faster than you dug yourself
access_2008-03-12
into it. It also allows someone else to back off to the previous
remark This ACL is placed inbound on
interface fa0/1 to control version if you are not available.
remark access from the wireless, WEP-only, Here is how it works. Suppose you want to apply a changed
network to Internal ACL on the interface shown. You have just created a new ACL
remark devices. JPM 2007-12-19. IB080315-fast0/1 to replace IB071112-fast0/1.
<snip>
Existing:
A network access list that controls traffic will generally have interface fastethernet0/1
several sections. It is not necessary to document every single ip access-group IB071112-fast0/1 in
line of an access list, but major sections should each have <snip>
their own remark. For example:
Commands to switch to the new access list:
<snip> conf t
remark Allow telnet from selected barcode interface fa0/1
scanners ip access-group IB080315-fast0/1 in
remark to the XYZ app server. Added 2008-03-15
by jpm. Commands to switch back to the old access list:
permit tcp host 10.10.10.10 host 192.168.1.1 eq conf t
telnet interface fa0/1
ip access-group IB071112-fast0/1 in
permit tcp host 10.10.10.11 host 192.168.1.1 eq
telnet
Notice the apply/back-off process remains the same, regard-
permit tcp host 10.10.10.12 host 192.168.1.1 eq
telnet less of the number of changes between the old and new access
deny ip any any list. It is a quick process, and least likely to cause disruption
to a production network.
At this point, one may ask why the names of the access lists As a side benefit, having the old access list available provides
should be so descriptive when you are putting as much or some ability to look back and see how things used to work.
more information in the remarks. The reason is to be able Access lists that are or have been previously applied will have
to understand the purpose of the access list when you see it “hitcounts” or “match counts.” Many times it is useful to
applied. Here is an example using route-redistribution where compare these values between the old and new access list.
an access list is applied. The first example is clearly more de-
scriptive than the second. Use an explicit final “deny any”
Good name One of the first things a new network engineer learns when
Router eigrp 100 distribute-list limit_routes_ studying access lists is the IOS places an implied deny any as
we_learn_from_Peoria_2008-03-12 in fa0/1 the last statement of any access list. It does not show up in the
<snip> output of a show access-list command, yet it is there nonethe-

35
Living with Access Lists | Jeffrey Monaco ISSA Journal | June 2008

less. This conforms to the good security practice of failing se- The key to this is that the masking, or wildcarding, shown
cure. Experience shows it is best, however, to explicitly specify above indicates how much of the leading part of the address
the final deny any on ACLs. to look at. The rest of the address is ignored. The first line, for
Functionally, an explicit deny any is not necessary. Its real instance, applies all addresses beginning with 10. The second
value becomes obvious when it is time to analyze, debug, or line applies to all addresses beginning with 192.168.
manage an access list. A show access-list command gives you Many network engineers struggle with masking as described
each line of the ACL and the number of times that line has above. Creative masking, described next, is an order of mag-
been matched. Consider the following from a sample show nitude more difficult to understand.
access-list Creative masking is when one builds the mask to apply to the
Extended IP access list Control_WEP_wireless_ middle part of the address, either ignoring or caring about
access_2008-03-12 selected bits. Does this sound confusing? It should; it is. Here
10 permit tcp host 10.10.10.10 host 192.168.1.1 is a simple example (and the only one typically used):
eq telnet (91895 matches)
20 permit tcp host 10.10.10.11 host 192.168.1.1 ip access-list extended control_telnet_access_
eq telnet (300 matches) to_routers_2008-03-12
30 permit tcp host 10.10.10.12 host 192.168.1.1 remark Allow anyone to telnet to the .1
eq telnet address of our 10.10.x.x/24
40 deny ip any any (5 matches) remark networks. All of our 10.10 networks are
subnetted Class C.
Versus permit ip any 10.10.0.1 0.0.255.0 eq telnet
deny ip any any
Extended IP access list Control_WEP_wireless_
access_2008-03-12 Note the wildcard bits are 0.0.255.0. To get a firm grasp on
10 permit tcp host 10.10.10.10 host 192.168.1.1 this, it is necessary to resort to binary. When the addresses
eq telnet (91895 matches)
and masking are written in binary, the logic makes sense.
20 permit tcp host 10.10.10.11 host 192.168.1.1
eq telnet (300 matches) This means you must be able to convert an IP address from
30 permit tcp host 10.10.10.12 host 192.168.1.1 its dotted-decimal notation to its binary equivalent, convert
eq telnet the access list wildcard specification to its binary equivalent,
40 deny ip any any (1299835 matches) and finally understand the results of the binary “or” function
as applied to the IP address and wildcard. In short, you must
Note the match count on the last line. The vast difference in be able to think in binary.
the number of denied packets may well be indicative of an
Though not often used in a production environment, vendors
exposure or intrusion attempt. Without the final deny any,
think knowledge of creative masking indicates deep network
this piece of vital information is not available.
ability and put related questions on certification exams.
Avoid creative masking This leads us to the times when it is safe to use creative mask-
ing in production. Ask the following questions:
Masking seen in access list entries indicates which bits of the
address are important when the device is looking at an IP ad- • Can you think in binary?
dress in a packet. This mask is sometimes referred to as the • Can the rest of your team think in binary?
wildcard bits or “wild-mask.” In a router, the mask is back-
• Can the technicians supporting your devices at 3:00
wards from what one expects to see as a subnet mask. For
am think in binary?
example, if the first three octets of an address are important,
you do not use 255.255.255.0 as might be expected. Rather, If you have answered yes to the above questions, then it is safe
the opposite is coded. In this case, the proper specification to use creative masking. Just bear in mind that it will make
is 0.0.0.255. (Note that in a Cisco™ PIX or ASA, masking subsequent analysis of the ACLs more difficult as well.
works as expected, and not with wildcard bits.) Finally, it is worth mentioning at this point that creative
Masking tells the IOS what parts of the address are impor- masking is not available in Cisco’s IPv6 implementation.
tant, and what parts to ignore. Here are some examples:
Do periodic ACL analysis
ip access-list extended allow only_private_
addresses_2008-03-12 The internetworking business is a rapidly changing environ-
permit ip 10.0.0.0 0.255.255.255 any ! Applies ment. Requirements change, topologies change, servers and
to any 10.x.x.x services change, all at an alarming rate. Network engineers
permit ip 192.168.0.0 0.0.255.255 any ! Applies make frequent changes to their ACLs to adjust to all of the
to 192.168.x.x changes. The network engineer’s primary focus is on making
permit ip 172.16.0.0 0.15.255.255 any ! Applies an application work and getting packets from one point to
to 172.16-31.x.x
deny ip any any another. Once they have a working ACL, they are often reluc-

36
Living with Access Lists | Jeffrey Monaco ISSA Journal | June 2008

tant to change it for fear of breaking a critical application or ever, it turns out that not all telnet clients are the same when
service. Over time, errors and mistakes can creep into access it comes to using copy/paste. From experience, we know that
lists. Also, as servers and services change and evolve, access two open source clients, TeraTerm and PuTTY, work well.
list entries become obsolete. The Microsoft™ command line client included with their
The next rule of Good ACL Management is “Do periodic ACL operating systems is tolerable. There are some expensive,
analysis.” For ACLs that control traffic, the security organi- proprietary telnet clients that are truly painful, at least when
zation should do this analysis. This applies the principle of using default settings. When doing a lot of ACL work via
separation of duties. For network topology access lists, those copy/paste, it will be worth your while to find a telnet client
related to route maps, QoS, and similar, someone from the that handles this function well. Those using a purchased tel-
network team that does not maintain these ACLs should do net client are well-advised to work with the various settings
the analysis. As with security related access lists, this will ap- of the software to make the “paste” process more efficient.
ply “separation of duties” to the process. As an alternative to using telnet cut/paste, tftp and ftp can be
Some of the things to look out for are services and servers used to apply an ACL. This is particularly useful with large
whose IP addresses have changed or been removed. Have access lists.
the old ACL entries been removed also? Does the business The other tool that is useful is a context-aware editor. There
no longer provide facilities on certain TCP or UDP ports, are a few available. An open source editor is Scite (sc1.exe).
or have the port numbers changed? Many times no one goes While it does not know the exact syntax of an ACL, it high-
back through a working access list to remove the old lines. lights the IP addresses and wildcard masks, making them
Pay particular attention to those ACLs that control business stand out. ACLs are easier to read, edit, and maintain this
partner access. Business relationships often silently expire way.
as contracts are not renewed. This information is not always
given to the security or networking teams. Conclusion
One of the more insidious errors that sneaks into access lists To review, the rules of Good ACL Management are:
is the logic error. This most often occurs in large, extended • Always use “named” access lists, and have meaning-
ACLs such as those protecting a corporate network from the ful names
Internet. Here is a simple example to illustrate:
• Always comment your ACLs with remarks
ip access-list extended Filter_Inbound_INET_
2008-03-20 • Always code a final deny any
remark This ACL is placed inbound to control • Never change an active ACL on-the-fly
traffic we let pass
remark to our firewall. Last update JPM 2008- • Avoid creative masking
03-20. • Do periodic analysis of your ACLs, applying separa-
remark *** permit traffic for the ERP tion of duties in the process
application 2005-11-08
permit tcp any any range 20 25 These are rules and methodologies we have learned through
<snip – 300 additional lines removed. experience over many years with many different clients. We
remark *** deny any inbound telnet per policy build a lot of ACLs for our clients, and we do numerous ACL
2007-06-01 analyses as part of security audits. We believe in the process
deny tcp any any eq telnet and are sufficiently committed to have invested in the cre-
ation of tools to use internally to both analyze and create
The deny tcp any any eq telnet line will never be hit because ACLs in support of the process and related methodologies.
the previous permit statement has already permitted the traf- As network engineering and security consultants, we do not
fic. This condition is not just related to TCP ports. It happens get invited back into a company if we do a poor job – this is
with overlapping network ranges, overriding protocols, and something we take seriously.
even overriding QoS settings. Some of these are very diffi-
cult to find. If the ACLs are also using creative masking, the
analysis is a nightmare.
About the Author
How important is this last point? At my company, we feel this Jeffrey Monaco, CISSP, CCNA, is the CTO
is important enough, and we do this often enough, that we of solutions4networks, a network consult-
invested resources to create our own internal tool just to deal ing company specializing in voice, data,
with this case. wireless and security. He has been working
Tools for and with Fortune 500 customers for 25
years in design and implementation of net-
One of the complaints usually heard when recommending work infrastructures for mission critical applications. He may
not changing ACLs on-the-fly is that it is slow and tedious be reached at jeff@s4nets.com.
to copy an existing ACL, change it, and reinsert it into the
configuration. This would not seem to be too difficult. How-

37

Das könnte Ihnen auch gefallen