8.2. Configuring a Packet Filtering Router
To configure a packet
filtering router, you first need to decide what services you want to
allow or deny, and then you need to translate your decisions into
rules about packets. In reality, you probably don't care about
the details of packets at all. What you want is to get your work
done. For example, you want to receive mail from the Internet, and
whether that's managed by packets or by Murphy's ghost is
irrelevant to you. The router, on the other hand, cares only about
packets, and only about very limited parts of them. In constructing
the rules for your routers, you have to translate the general
statement "Receive mail from the Internet" into a
description of the particular kinds of packets you want the router to
allow to pass.
The following sections outline the general concepts you need to keep
in mind when translating decisions about services into rules about
packets. The specific details for each service are described in Part I, "Network Security" of this book.
8.2.1. Protocols Are Usually Bidirectional
Protocols are usually bidirectional;
they almost always involve one side's sending an inquiry or a
command, and the other side's sending a response of some kind.
When you're planning your packet filtering rules, you need to
remember that packets go both ways. For example, it doesn't do
any good to allow outbound Telnet packets that carry your keystrokes
to a remote host, if you don't also allow the incoming packets
for that connection that carry the screen display back to you.
Conversely, it also won't do you any good to block only half a
connection. Many attacks can be carried out if attackers can get
packets into your network, even if the attackers can't get any
responses back. This can be possible for several reasons. For
instance, attackers may only be interested in issuing a particular
command which does not require a response (like "shut down your
network interface" for a denial of service attack, using an
SNMP set command). Or, the responses may be predictable enough to
allow attackers to carry on their side of the conversation without
having to actually see the responses at all. If the responses are
predictable, an attacker doesn't need to see them. They
won't be able to extract any information directly if they
don't see the responses, but they may be able to do something
that gives them the data indirectly. For example, even if they
can't see your /etc/passwd file directly,
they can probably issue a command to mail a copy.
8.2.2. Be Careful of "Inbound" Versus "Outbound" Semantics
When
you're planning your packet filtering strategy, you need to be
careful in your discussions of "inbound" versus
"outbound". You need to carefully distinguish between
inbound and outbound
packets, and inbound and
outbound
services. An outbound service (e.g.,
the Telnet service mentioned previously) involves both outbound
packets (your keystrokes) and inbound packets (the responses to be
displayed on your screen). Although most people habitually think in
terms of
services, you need to make sure you
think in terms of
packets when you're
dealing with packet filtering. When you talk to others about
filtering, be sure to communicate clearly whether you're
talking about inbound versus outbound packets, or inbound versus
outbound services.
8.2.3. Default Permit Versus Default Deny
In
Chapter 3, "Security Strategies", we
distinguished between the two stances you can choose in putting
together your security policy: the default deny stance (that which is
not expressly permitted is prohibited) and the default permit stance
(that which is not explicitly prohibited is permitted). From a
security point of view, it is far safer to take the attitude that
things should be denied by default. Your packet filtering rules
should reflect this stance. As we discussed earlier, start from a
position of denying everything and then set rules that allow only
protocols that you need, that you understand the security
implications of, and that you feel that you can provide safely enough
(according to your own particular definition of "safely
enough") for your purposes.
The default deny stance is much safer and more effective than the
default permit stance, which involves permitting everything by
default and trying to block those things that you know are problems.
The reality is that with such an approach, you'll never know
about all the problems, and thus you'll never be able to do a
complete job.
In practical terms, the default deny stance means that your filtering
rules should be a small list of specific things that you allow,
perhaps with a few very specific things you deny scattered throughout
to make the logic come out right, followed by a default deny that
covers everything else. We'll explain in detail how these rules
work later in this chapter.
Filtering by Interface
One key piece of
information is useful when you are making a packet filtering
decision, but it can't be found in the headers of the packet;
this is the interface on which the packet came into the router or is
going out of the router. This is important information because it
allows the router to detect forged packets.
If the sole router between your internal net and the external world
receives a packet with an internal source address from the internal
interface, there is no problem; all packets coming from the inside
will have internal source addresses. If, however, the router receives
a packet with an internal source address from the external interface,
it means either that someone is forging the packet (probably in an
attempt to circumvent security), or that something is seriously wrong
with your network configuration.
You can get these packets without forgery. For example, someone might
have set up a second connection between your net and the outside
world, such as a dial-up PPP link from a user's desk, probably
with little or no thought to security. As a result, the traffic that
should be staying internal to your net is "leaking" out
through this second connection, going across the Internet, and trying
to come back in through your "front door". There's
little you can do to detect such illicit "back door"
connections except by detecting internal packets arriving from the
outside; about the best you can do is have a strong and
well-publicized policy against them, and provide as many as possible
of the services your users desire through the front door (the
firewall), so that they don't feel a compelling need to create
their own back door.
These packets should be logged and treated as urgent issues. If
someone is forging them, that person is attacking you with some
seriousness. If the packets are leaked from a back door, you have a
security problem because of the extra Internet connection. You may
also have a routing problem: a host that claims to be internal and
advertises routes for itself is in danger of getting all of your
internal network's traffic. This is bad if it's a PPP
link, which is probably not going to handle the load. It's much
worse if it's not connected to your network at all because some
or all of your network's traffic is going to disappear.
|
| | |
8. Packet Filtering | | 8.3. What Does the Router Do with Packets? |