0

I am interested in setting up a firewall. This is going to include your usual NAT, with port-forwarding for incoming connections.

However I want the outgoing connections to use a whitelist of hostnames. I also want the same device to act as the DNS server that my PCs use so it always knows the latest IP for any hostname on the whitelist when a PC is trying to connect to it.

This can either be Cisco IOS, a recommended alternative, or an actual Illumos or Linux server. I'm thinking that using a server will give me more flexibility, but I'm open to suggestions.

Here's what I want to happen: (outgoing connections, from a user on my network)

  1. The user's PC performs a DNS lookup for a given site (i.e. serverfault.com)

  2. The firewall server compares this to a whitelist of hostnames, and if it is permitted then the resulting IP addresses are passed back to the PC.

  3. If the DNS lookup was allowed, then the IP access list is immediately updated with the most recent results from DNS. (with reasonable expiration)

    • If a PC initiates a connection an arbitrary IP address, which was not listed on any of the approved DNS responses, then arbitrary packets can be refused.
  4. (optional, but preferable) sniff the TCP connection to verify the hostname of the HTTP or HTTPS connection. In this way, we can prevent accessing a non-whitelisted site that may exist on a shared, whitelisted IP.

I think that I can accomplish items 1-3 with ipfilter, combined with a custom-written DNS server to handle the whitelist, and trigger the additions to ipfilter. Does this sound reasonable, or will there be inevitable issues with ipfilter not recognizing changes immediately? I'm pretty sure ipfilter will work with a Linux/Illumos NAT.

Is there an application for Linux or Illumos that already does DNS-triggered IP whitelisting? (keeps me from re-inventing the wheel)

I've not heard of IOS running a DNS server. Is there a solution in Cisco IOS that handles this? Is there an obvious solution I should know about, or is this simply an unusual firewall setup?

16
  • 1
    Do you even understand the DNS lookup process? Your server will not know of every request for your domain's IP and that information is public. Jul 8, 2016 at 20:28
  • I totally understand DNS. Perhaps you mis-understand my question. The PCs on my network will use my server as the DNS server in step 1, and thus my server will know of every hostname the PCs on my network are trying to connect to to make a determination of step 2. Jul 8, 2016 at 20:31
  • I posted a related question about intercepting packets with a high-level language such as Java. It may be that I accomplish steps 1-3 with ipfilter and my own DNS server and then for step 4 I roll my own Packet Filter, but that would be long-term given the level of complexity involved. Jul 8, 2016 at 20:53
  • How would that serve at securing your application since all systems use DNS queries to get the IP of a domain name when they don't already know it? Jul 8, 2016 at 20:56
  • 1
    The question is different, but the answer is effectively the same one that can be found in this Q&A. There is a strong aversion to using firewalls in ways that incorporate changing DNS data (non-deterministic behavior and reliance upon an easily spoofed protocol), and it is unlikely that a solution exists which you will not have to design yourself. Even so, as a DNS professional I would strongly recommend against it.
    – Andrew B
    Jul 8, 2016 at 21:29

1 Answer 1

3

Per our discussion in the comments, it sounds like you may be confusing the role of a firewall with that of a transparent proxy.

  • Firewalls do not rely upon DNS resolution to implement access policies. There are several reasons for this that I have covered before. The most significant reasons are:

    1. Reliance upon an easily spoofed protocol
    2. Added software complexity and non-deterministic functionality from a given input set (what passes the filter today may not be what passes the filter tomorrow)
    3. Effectively delegating management of the firewall policy to a different device and protocol.
  • Transparent proxies typically intercept HTTP+DNS traffic, and apply access controls based on the hostnames being requested. The IP address is not a consideration at this layer. If the requested entity does not match an allowed name, an error page is returned directly from the transparent proxy itself without routing the request to the intended resource.

The primary difference is the layer at which these devices operate. Since the transparent proxy only has to concern itself with names, and not the IP addresses that those names resolve to, you don't run into the same logic problems that a firewall does.

0

Not the answer you're looking for? Browse other questions tagged .