14.4 DNS and Internet Firewalls

Team-Fly    

 
DNS on Windows 2000, 2nd Edition
By Matt Larson, Cricket Liu
Table of Contents
Chapter 14.  Miscellaneous


The Domain Name System wasn't designed to work with Internet firewalls. It's a testimony to the flexibility of DNS that you can configure DNS to work with, or even through, an Internet firewall.

That said, configuring the Microsoft DNS Server to work in a firewalled environment, although not difficult, takes a good, complete understanding of DNS. Describing it also requires a large portion of this chapter, so here's a roadmap.

We start by describing the two major families of Internet firewall software: packet filters and application gateways. The capabilities of each family have a bearing on how you'll need to configure your DNS servers to work through the firewall. The next section details the two most common DNS architectures used with firewalls, forwarders and internal roots, and describes the advantages and disadvantages of each. Finally, we discuss split namespaces and the configuration of the bastion host, the host at the core of your firewall system.

14.4.1 Types of Firewall Software

Before you start configuring your DNS servers to work with your firewall, it's important that you understand what your firewall is capable of. Your firewall's capabilities will influence your choice of DNS architecture and will determine how you implement it. If you don't know the answers to the questions in this section, track down someone in your organization who does know and ask. Better yet, work with your firewall's administrator when designing your DNS architecture to ensure it will coexist with the firewall.

Note that this is far from a complete explanation of Internet firewalls. These few paragraphs describe only the two most common types of Internet firewalls and only in enough detail to show how the differences in their capabilities impact name servers. For a comprehensive treatment of Internet firewalls, see Elizabeth Zwicky, Simon Cooper, D. Brent Chapman, and Deborah Russell's Building Internet Firewalls (O'Reilly).

14.4.1.1 Packet filters

The first type of firewall we'll cover is the packet-filtering firewall. Packet-filtering firewalls operate largely at the transport and network levels of the TCP/IP stack ( layers three and four of the OSI reference model, if you dig that). They decide whether to route a packet based upon packet-level criteria such as the transport protocol (e.g., whether it's TCP or UDP), the source and destination IP addresses, and the source and destination ports (see Figure 14-1).

Figure 14-1. Packet filters operate at the network and transport layers of the stack
figs/dnsw_1401.gif

What's most important to us about packet-filtering firewalls is that you can typically configure them to selectively allow DNS traffic between hosts on the Internet and your internal hosts. That is, you can let an arbitrary set of internal hosts communicate with Internet name servers. Some packet-filtering firewalls can even permit your name servers to query name servers on the Internet, but not vice versa. All router-based Internet firewalls are packet-filtering firewalls. Check Point's FireWall-1, Cisco's PIX, and Sun's SunScreen are popular commercial packet-filtering firewalls.

14.4.1.2 Application gateways

Application gateways operate at the application protocol level, several layers higher in the OSI reference model than most packet filters (Figure 14-2). In a sense, they "understand" the application protocol in the same way a server for that particular application would. An FTP application gateway, for example, can make the decision to allow or deny a particular FTP operation, like a RETR (a get ) or a STOR (a put ).

Figure 14-2. Application gateways operate at the application layer of the stack
figs/dnsw_1402.gif

The bad news, and what's important for our purposes, is that most application gateway-based firewalls handle only TCP-based application protocols. DNS, of course, is largely UDP-based, and we know of no application gateways for DNS. This implies that if you run an application gateway-based firewall, your internal hosts will likely not be able to communicate directly with name servers on the Internet.

The popular Firewall Toolkit from Trusted Information Systems (TIS, now part of Network Associates) is a suite of application gateways for common Internet protocols such as Telnet, FTP, and HTTP. Network Associates' Gauntlet product is also based on application gateways, as is Axent's Eagle Firewall.

Note that these two categories of firewalls are really just generalizations . The state of the art in firewalls changes very quickly, and by the time you read this, you may have a firewall that includes an application gateway for DNS. Which family your firewall falls into is important only because it suggests what that firewall is capable of; what's more important is whether your particular firewall will let you permit DNS traffic between arbitrary internal hosts and the Internet.

14.4.2 A Bad Example

The simplest configuration is to allow DNS traffic to pass freely through your firewall ( assuming you can configure your firewall to do that). That way, any internal name server can query any name server on the Internet, and any Internet name server can query any of your internal name servers. You don't need any special configuration.

Unfortunately, this is a bad idea, for two reasons:

Version control

The developers of the Microsoft DNS Server are constantly finding and fixing security- related bugs in the code. Consequently, it's important to run a recent version of the server, especially for name servers that are directly exposed to the Internet. If one or just a few of your name servers communicate directly with name servers on the Internet, upgrading them to a new version is easy. If all of the name servers on your network do, upgrading all of them is vastly more difficult.

Possible vector for attack

Even if you're not running a name server on a particular host, a hacker might be able to take advantage of the fact that you allow DNS traffic through your firewall to attack that host. For example, a co-conspirator working on the inside could set up a Telnet daemon listening on the host's DNS port, allowing the hacker to telnet right in.

For the rest of this chapter, we'll try to set a good example.

14.4.3 Internet Forwarders

Given the dangers of allowing bidirectional DNS traffic through the firewall unrestricted, most organizations elect to limit the internal hosts that can "talk DNS" to the Internet. With an application gateway firewall, or any firewall without the ability to pass DNS traffic, the only host that can communicate with Internet name servers is the bastion host (see Figure 14-3).

Figure 14-3. A small network, showing the bastion host
figs/dnsw_1403.gif

With a packet-filtering firewall, the firewall's administrator can configure the firewall to let any set of internal name servers communicate with Internet name servers. Often, this is a small set of hosts that run name servers under the direct control of the network administrator (see Figure 14-4).

Figure 14-4. A small network, showing select internal name servers
figs/dnsw_1404.gif

Internal name servers that can query name servers on the Internet directly don't require any special configuration. Their root hints files contain the Internet's root name servers, which enables them to resolve Internet domain names . Internal name servers that can't query name servers on the Internet, however, need to know to forward queries they can't resolve to one of the name servers that can. This is done with the Forwarders tab on the server's Properties window, described in Chapter 10.

Figure 14-5 illustrates a common forwarding setup, with internal name servers forwarding queries to a name server running on a bastion host.

Figure 14-5. Using forwarders
figs/dnsw_1405.gif

At Movie U., we put in a firewall to protect ourselves from the Big Bad Internet several years ago. Ours is a packet-filtering firewall, and we negotiated with our firewall administrator to allow DNS traffic between Internet name servers and two of our name servers, terminator.movie.edu and wormhole.movie.edu . Figure 14-6 shows how we configured the other internal name servers at the university.

Figure 14-6. Internal name server forwarding configuration
figs/dnsw_1406.gif

When configuring different internal name servers, we vary the order in which the forwarders appear to help spread the load among them.

When an internal name server receives a query for a name it can't resolve locally, such as an Internet domain name, it forwards that query to one of our forwarders, which can resolve the name using name servers on the Internet. Simple!

14.4.3.1 The trouble with forwarding

Unfortunately, it's a little too simple. Forwarding starts to get in the way once you delegate subdomains or build an extensive network. To explain what we mean, take a look at zardoz.movie.edu . zardoz.movie.edu is a slave for movie.edu and uses our two forwarders. What happens when zardoz.movie.edu receives a query for a name in fx.movie.edu ? zardoz.movie.edu , as an authoritative movie.edu name server, has the NS records that delegate fx.movie.edu to its authoritative name servers. But it's also been configured to forward queries it can't resolve locally to terminator.movie.edu and wormhole.movie.edu . Which will it do?

It turns out that zardoz.movie.edu will ignore the delegation information and forward the query to terminator.movie.edu . That'll work since terminator.movie.edu will receive the recursive query and ask an fx.movie.edu name server on zardoz.movie.edu 's behalf . But it's not particularly efficient, since zardoz.movie.edu could easily have sent the query directly.

Now imagine the scale of the network is much larger: a corporate network that spans continents, with tens of thousands of hosts and hundreds or thousands of name servers. All of the internal name servers that don't have direct Internet connectivitythe vast majority of themuse a small set of forwarders. There are several things wrong with this picture:

Single point of failure

If the forwarders fail, your name servers lose the ability to resolve both Internet domain names and internal domain names that they don't have cached or in authoritative data.

Concentration of load

The forwarders will have an enormous query load placed on them. This is both because of the large number of internal name servers that use them and because the queries are recursive and require a good deal of work to answer.

Inefficient resolution

Imagine two internal name servers, authoritative for west.acmebw.com and east.acmebw.com , respectively, both on the same network segment in Boulder, Colorado. Both are configured to use the company's forwarder in Bethesda, Maryland. To resolve a name in east.acmebw.com , the west.acmebw.com name server sends a query to the forwarder in Bethesda. The forwarder in Bethesda then sends a query back to Boulder to the east.acmebw.com name server, the original querier's neighbor. The east.acmebw.com name server replies by sending a response back to Bethesda, which the forwarder sends back to Boulder.

In a traditional configuration with root name servers, the west.acmebw.com name server would quickly have learned that an east.acmebw.com name server was next door and would favor it (because of its low roundtrip time). Using forwarders "short-circuits" the normally efficient resolution process.

The upshot is that forwarding is fine for small networks and simple namespaces but probably inadequate for large networks and complex namespaces. We found this out the hard way at Movie U. as our network grew and we were forced to implement internal roots.

14.4.4 Internal Roots

If you want to avoid the scalability problems of forwarding, you can set up your own root name servers. These internal roots will serve only the name servers in your organization. They'll know about only the portions of the namespace relevant to your organization.

What good are they? By using an architecture based on root name servers, you gain the scalability of the Internet namespace (which should be good enough for most companies), plus redundancy, distributed load, and efficient resolution. You can have as many internal roots as the Internet has roots?3 or sowhereas having that many forwarders may be an undue security exposure and a configuration burden . Most of all, the internal roots don't get used frivolously. Name servers need to consult an internal root only when they time out the NS records for your top-level zones. Using forwarders, name servers may have to query a forwarder once per resolution .

The moral of our story is that if you have, or intend to have, a large namespace and lots of internal name servers, internal root name servers will scale better than any other solution.

14.4.4.1 Where to put internal root name servers

Since name servers "lock on" to the closest root name server by favoring the one with the lowest roundtrip time, it pays to pepper your network with internal root name servers. If your organization's network spans the U.S., Europe, and the Pacific Rim, consider locating at least one internal root name server on each continent . If you have three major sites in Europe, give each of them an internal root.

14.4.4.2 Forward-mapping delegation

Here's how an internal root name server is configured. An internal root delegates directly to any zones you administer. For example, on the movie.edu network, the root zone's data file would contain:

 movie.edu.  86400  IN  NS  terminator.movie.edu.             86400  IN  NS  wormhole.movie.edu.             86400  IN  NS  zardoz.movie.edu. terminator.movie.edu.  86400  IN  A  192.249.249.3 wormhole.movie.edu.    86400  IN  A  192.249.249.1                        86400  IN  A  192.253.253.1 zardoz.movie.edu.      86400  IN  A  192.249.249.9                        86400  IN  A  192.253.253.9 

On the Internet, this information would appear in the edu name servers' zone data files. On the movie.edu network, of course, there aren't any edu name servers, so you delegate directly to movie.edu from the root.

Notice that this example doesn't contain delegation to fx.movie.edu or any other subdomain of movie.edu . The movie.edu name servers know which name servers are authoritative for all movie.edu subdomains, and all queries for information in those subdomains pass through the movie.edu name servers, so there's no need to delegate them here.

14.4.4.3 in-addr.arpa delegation

We also need to delegate from the internal roots to the in-addr.arpa zones that correspond to the networks at the university:

 249.249.192.in-addr.arpa.  86400  IN  NS  terminator.movie.edu.                            86400  IN  NS  wormhole.movie.edu.                            86400  IN  NS  zardoz.movie.edu. 253.253.192.in-addr.arpa.  86400  IN  NS  terminator.movie.edu.                            86400  IN  NS  wormhole.movie.edu.                            86400  IN  NS  zardoz.movie.edu. 254.253.192.in-addr.arpa.  86400  IN  NS  bladerunner.fx.movie.edu.                            86400  IN  NS  outland.fx.movie.edu.                            86400  IN  NS  alien.fx.movie.edu. 20.254.192.in-addr.arpa.   86400  IN  NS  bladerunner.fx.movie.edu.                            86400  IN  NS  outland.fx.movie.edu.                            86400  IN  NS  alien.fx.movie.edu. 

Notice that we did include delegation for the 254.253.192.in-addr.arpa and 20.254.192.in-addr.arpa zones, even though they both correspond to the fx.movie.edu zone. We didn't need to delegate to fx.movie.edu because we'd already delegated to its parent, movie.edu . The movie.edu name servers delegate to fx.movie.edu , so by transitivity the roots delegate to fx.movie.edu . Since neither of the other in-addr.arpa zones is a parent of 254.253.192.in-addr.arpa or 20.254.192.in-addr.arpa , we needed to delegate both zones from the root.

As we've explained earlier, we don't need to add address records for the three Special Effects name servers, bladerunner.fx.movie.edu , outland.fx.movie.edu , and alien.fx.movie.edu , because a remote name server can already find their addresses by following delegation from movie.edu .

14.4.4.4 The root.dns file

All that's left is to add an SOA record for the root zone and NS records for this internal root name server and any others:

 .  IN  SOA  rainman.movie.edu.  hostmaster.movie.edu.  (             1        ; serial             10800    ; refresh             3600     ; retry             604800   ; expire             86400 )  ; default TTL    IN  NS  rainman.movie.edu.    IN  NS  awakenings.movie.edu. rainman.movie.edu.    IN  A  192.249.249.254 awakenings.movie.edu. IN  A  192.253.253.254 

rainman.movie.edu and awakenings.movie.edu are the hosts running internal root name servers. We shouldn't run an internal root on a bastion host because if a name server on the Internet accidentally queries it for data it's not authoritative for, the internal root will respond with its list of rootsall internal!

So the whole root.dns file (by convention, we call the root zone's data file root.dns ) looks like this:

 .  IN  SOA  rainman.movie.edu.  hostmaster.movie.edu.  (             1       ; serial             10800   ; refresh             3600    ; retry             604800  ; expire             86400 ) ; default TTL    IN  NS  rainman.movie.edu.    IN  NS  awakenings.movie.edu. rainman.movie.edu.    IN  A  192.249.249.254 awakenings.movie.edu. IN  A  192.253.253.254 movie.edu.  IN  NS  terminator.movie.edu.             IN  NS  wormhole.movie.edu.             IN  NS  zardoz.movie.edu. terminator.movie.edu.  IN  A  192.249.249.3 wormhole.movie.edu.    IN  A  192.249.249.1                        IN  A  192.253.253.1 zardoz.movie.edu.      IN  A  192.249.249.9                        IN  A  192.253.253.9 249.249.192.in-addr.arpa.  IN  NS  terminator.movie.edu.                            IN  NS  wormhole.movie.edu.                            IN  NS  zardoz.movie.edu. 253.253.192.in-addr.arpa.  IN  NS  terminator.movie.edu.                            IN  NS  wormhole.movie.edu.                            IN  NS  zardoz.movie.edu. 254.253.192.in-addr.arpa.  IN  NS  bladerunner.fx.movie.edu.                            IN  NS  outland.fx.movie.edu.                            IN  NS  alien.fx.movie.edu. 20.254.192.in-addr.arpa.   IN  NS  bladerunner.fx.movie.edu.                            IN  NS  outland.fx.movie.edu.                            IN  NS  alien.fx.movie.edu. 

Creating the root zone with the DNS console on both of the internal root name servers, rainman and awakenings , is just like creating any primary zone: right-click on the server's name in the left pane, then choose New Zone... . For the zone's domain name, choose . (a single dot). The DNS console helpfully uses root.dns as the default filename for this zone.

If you don't have a lot of idle hosts sitting around that you can turn into internal roots, don't despair! Any internal name server (i.e., one that's not running on a bastion host or outside your firewall) can serve double duty as an internal root and as an authoritative name server for whatever other zones you need it to load. Remember, a single name server can be authoritative for many, many zones, including the root zone.

14.4.4.5 Configuring other internal name servers

Once you've set up internal root name servers, configure all the name servers on hosts anywhere on your internal network to use them. Any name server running on a host without direct Internet connectivity (i.e., behind the firewall) should list the internal roots in its root hints file:

 ; Internal cache.dns file, for Movie U. hosts without direct ; Internet connectivity ; ; Don't use this file on a host with Internet connectivity! ; .  99999999  IN  NS  rainman.movie.edu.    99999999  IN  NS  awakenings.movie.edu. rainman.movie.edu.     99999999  IN  A  192.249.249.254 awakenings.movie.edu.  99999999  IN  A  192.253.253.254 

Name servers running on hosts using this root hints file will be able to resolve domain names in movie.edu and in Movie U.'s in-addr.arpa domains but not outside of those domains.

14.4.4.6 How internal name servers use internal roots

To tie together how this whole scheme works, let's go through an example of name resolution on an internal caching-only name server using these internal root name servers. First, the internal name server receives a query for a domain name in movie.edu , say the address of gump.fx.movie.edu . If the internal name server doesn't have any "better" information cached, it starts by querying an internal root name server. If it has communicated with the internal roots before, it has a roundtrip time associated with each, which tells it which of the internal roots is responding to it most quickly. It sends a nonrecursive query to that internal root for gump.fx.movie.edu 's address. The internal root answers with a referral to the movie.edu name servers on terminator.movie.edu , wormhole.movie.edu , and zardoz.movie.edu . The caching-only name server follows up by sending another nonrecursive query to one of the movie.edu name servers for gump.fx.movie.edu 's address. The movie.edu name server responds with a referral to the fx.movie.edu name servers. The caching-only name server sends the same nonrecursive query for gump.fx.movie.edu 's address to one of the fx.movie.edu name servers and finally receives a response.

Contrast this with the way a forwarding setup would have worked. Let's imagine that instead of using internal root name servers, our caching-only name server were configured to forward queries first to terminator.movie.edu and then to wormhole.movie.edu . In that case, the caching-only name server would have checked its cache for the address of gump.fx.movie.edu and, not finding it, would have forwarded the query to terminator.movie.edu . terminator.movie.edu would have queried an fx.movie.edu name server on the caching-only name server's behalf and returned the answer. Should the caching-only name server need to look up another name in fx.movie.edu , it would still ask the forwarder, even though the forwarder's response to the query for gump.fx.movie.edu 's address probably contained the names and addresses of the fx.movie.edu name servers.

14.4.4.7 The trouble with internal roots

Unfortunately, just as forwarding has its problems, internal root architectures have their limitations. Chief among these is the fact that your internal hosts can't see the Internet namespace. On some networks this isn't an issue, because most internal hosts don't have direct Internet connectivity. The few that do can have their resolvers configured to use a name server on the bastion host. Some of these hosts will probably need to run proxy servers to allow other internal hosts access to services on the Internet.

On other networks, however, the Internet firewall or other software may require that all internal hosts have the ability to resolve names in the Internet namespace. For these networks, an internal root architecture won't work.

14.4.5 A Split Namespace

Many organizations would like to advertise different zone data to the Internet than they do internally. In most cases, much of the internal zone data is irrelevant to the Internet because of the organization's Internet firewall. The firewall may not allow direct access to most internal hosts and may also translate internal, unregistered IP addresses into a range of IP addresses registered to the organization. Therefore, the organization may need to trim out irrelevant information from the external view of the zone or change internal addresses to their external equivalents.

Unfortunately, the Microsoft DNS Server doesn't support automatic filtering and translation of zone data. Consequently, many organizations manually create what have become known as "split namespaces." In a split namespace, the real namespace is available only internally while a pared-down, translated version of it, called the shadow namespace , is visible to the Internet.

The shadow namespace contains the name-to-address and address-to-name mappings of only those hosts that are accessible from the Internet through the firewall. The addresses advertised may be the translated equivalents of internal addresses. The shadow namespace may also contain one or more MX records to direct mail from the Internet through the firewall to a mail server.

Since Movie U. has an Internet firewall that greatly limits access from the Internet to the internal network, we elected to create a shadow namespace . For the movie.edu zone, the only information we need to give out is about the domain name movie.edu (an SOA record and a few NS records), the bastion host ( postmanrings2x.movie.edu ), and our new external name server, ns.movie.edu , which also functions as an external web server, www.movie.edu . The address of the external interface on the bastion host is 200.1.4.2, while the address of the name/web server is 200.1.4.3. The shadow movie.edu zone data file looks like this:

 @    IN    SOA    ns.movie.edu.    hostmaster.movie.edu. (                            1       ; Serial                            10800   ; Refresh                            3600    ; Retry                            604800  ; Expire                            86400 ) ; Default TTL     IN    NS    ns.movie.edu.     IN    NS    ns1.isp.net.        ; our ISP's name server is a movie.edu slave     IN    A     200.1.4.3     IN    MX    10 postmanrings2x.movie.edu.     IN    MX    100 mail.isp.net. www             IN    CNAME movie.edu. postmanrings2x  IN    A     200.1.4.2                 IN    MX    10 postmanrings2x.movie.edu.                 IN    MX    100 mail.isp.net. ;postmanrings2x.movie.edu handles mail addressed to ns.movie.edu ns              IN    A     200.1.4.3                 IN    MX    10 postmanrings2x.movie.edu.                 IN    MX    100 mail.isp.net. *               IN    MX    10 postmanrings2x.movie.edu.                 IN    MX    100 mail.isp.net. 

Note that there's no mention of any of the subdomains of movie.edu , including any delegation to the name servers for those subdomains. That information isn't necessary, since there's nothing in any of the subdomains you can get to from the Internet and inbound mail addressed to hosts in the subdomains is caught by the wildcard.

The 4.1.200.in-addr.arpa.dns file, which we need to reverse map the two Movie U. IP addresses that hosts on the Internet might see, looks like this:

 $TTL 1d @    IN    SOA    ns.movie.edu.    hostmaster.movie.edu. (                            1       ; Serial                            10800   ; Refresh                            3600    ; Retry                            604800  ; Expire                            86400 ) ; Default TTL     IN    NS    ns.movie.edu.     IN    NS    ns.isp.net. 2    IN    PTR    postmanrings2x.movie.edu. 3    IN    PTR    ns1.movie.edu. 

One precaution we need to take is to make sure that the resolver on our bastion host isn't configured to use the server on ns.movie.edu . Since that server can't see the real, internal movie.edu , using it would render postmanrings2x.movie.edu unable to map internal names to addresses or internal addresses to names.

14.4.5.1 Configuring the bastion host

The bastion host is a special case in a split- namespace configuration. The bastion host has a foot in each environment: one network interface connects it to the Internet and another connects it to the internal network. Now that we have split our namespace in two, how can our bastion host see both the Internet namespace and our internal namespace ? If we configure it with the Internet's root name servers in its root hints file, it will follow delegation from the Internet's edu name servers to an external movie.edu name server with shadow zone data. It would be blind to our internal namespace , which it needs to see to log connections, deliver inbound mail, and more. On the other hand, if we configure it with our internal roots it won't see the Internet namespace , which it clearly needs to do in order to function as a bastion host. What to do?

If we have internal name servers that can resolve both internal and Internet domain namesusing the forwarding configuration earlier in this chapter, for examplewe can simply configure the bastion host's resolver to query those name servers. But if we use forwarding internally, depending on the type of firewall we're running we may also need to run a forwarder on the bastion host itself. If the firewall won't pass DNS traffic, we'll need to run at least a caching-only name server, configured with the Internet roots, on the bastion host so that our internal name servers will have somewhere to forward their unresolved queries.

If our internal name servers aren't configured to forward zones, the name server on our bastion host must be configured as a slave for movie.edu and any in-addr.arpa zones in which it needs to resolve addresses. This way, if it receives a query for a domain name in movie.edu , it'll use its local authoritative data to resolve the name. (If our internal name servers support forward zones and are configured correctly, the name server on our bastion host will never receive queries for names in movie.edu .) If the domain name is in a subdomain of movie.edu , it'll follow NS records in the zone data to query an internal name server for the name. Therefore, it doesn't need to be configured as a slave for any movie.edu subdomains, such as fx.movie.edu , just the "topmost" zone (see Figure 14-7).

Figure 14-7. A split DNS solution
figs/dnsw_1407.gif

Team-Fly    
Top


DNS on Windows 2000
DNS on Windows 2000
ISBN: 0596002300
EAN: 2147483647
Year: 2001
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net