Firewall Modules and Modular Firewalls H. B. Acharya University of Texas at Austin acharya@cs.utexas.edu Aditya Joshi University of Texas at Austin adityaj@cs.utexas.edu M. G. Gouda National Science Foundation mgouda@nsf.gov Abstract—A firewall is a packet filter placed at an entry point of a network in the Internet. Each packet that goes through this entry point is checked by the firewall to determine whether to accept or discard the packet. The firewall makes this determination based on a specified sequence of overlapping rules. The firewall uses the first-match criterion to determine which rule in the sequence should be applied to which packet. Thus, to compute the set of packets to which a rule is applied, the firewall designer needs to consider all the rules that precede this rule in the sequence. This “rule dependency” complicates the task of designing firewalls (especially those with thousands of rules), and makes firewalls hard to understand. In this paper, we present a metric, called the dependency metric, for measuring the complexity of firewalls. This metric, though accurate, does not seem to suggest ways to design firewalls whose dependency metrics are small. Thus, we present another metric, called the in- version metric, and develop methods for designing firewalls with small inversion metrics. We show that the dependency metric and the inversion metric are correlated for some classes of firewalls. So by aiming to design firewalls with small inversion metrics, the designer may end up with firewalls whose dependency metrics are small as well. We present a method for designing modular firewalls whose inversion metrics are very small. Each modular firewall consists of several components, called firewall modules. The inversion metric of each firewall module is very small - in fact, 1 or 2. Thus, we conclude that modular firewalls are easy to design and easy to understand. I. I NTRODUCTION A firewall is a packet filter that is placed at an entry point of a network in the Internet. The function of a firewall is to check each packet that goes through the entry point (at which the firewall is located) and determine whether to accept the packet and allow it to proceed on its way or to discard the packet. The firewall perform its function based on a specified sequence of rules. Each rule is of the form < predicate >→< decision > where < predicate > is a function that assigns to each packet a boolean value, true or false, and < decision > is either ”accept” or ”discard”. When a packet p reaches a firewall F , F performs two steps: 1) F identifies the first rule r (in its sequence of rules) whose < predicate > assigns the value true to packet p. 2) If the < decision > of rule r is accept (or discard, respectively) then F accepts (or discards, respectively) packet p. Note that F employs a ”first-match” criterion to determine which rule (in its sequence of rules) should be applied to which packet. This first-match criterion allows the rules in the rule sequence to be “overlapping”. This can be both advantageous and disadvantageous. The advantage of making the rules in the rule sequence overlapping is that it reduces the number of rules in the rule sequence, sometimes dramatically. The disadvantage of making the rules in the rule sequence overlapping is that it creates many dependencies between the rules in the rule sequence. This, in turn, complicates the task of designing and understanding the rule sequence. For instance, if the firewall designer needs to compute the set of packets to which a rule r (in the rule sequence) applies, then the designer needs to consider not only rule r but also all the rules that precede r in the rule sequence. In this paper, we introduce a metric, called the “dependency metric”, that measures the complexity of firewalls. The more the value of the metric for a given firewall, the more complex the firewall is and the harder it is to design and understand. Unfortunately, the dependency metric, though accurate, does not seem to suggest methods for designing firewalls for which the values of the metric are small. Thus, we introduce another complexity metric, called the “inversion metric”, for measuring the complexity of firewalls. We show, below, that the dependency metric and the inver- sion metric are correlated (at least for a rich class of firewalls called “uniform firewalls”). This result allows us to use the inversion metric as a good approximation of the dependency metric. Then, we identify three classes of firewalls, namely “simple firewalls”, “partitioned firewalls”, and “modular firewalls”, for which the values of the inversion metric are small. (This implies that these classes of firewalls are easier to design and understand.) We also describe methods for designing firewalls in these three classes. Of particular interest is the class of modular firewalls. Each modular firewall consists of simple firewall components, called “firewall modules”. The value of the inversion metric for each firewall module is 1 or 2. This causes the value of the inversion metric for the full firewall to be 1 or 2. (Note that the smallest possible value of the inversion metric is 1.) We present an algorithm that takes as input any firewall F whose inversion metric is large and computes as output an equivalent modular firewall MF whose inversion metric is (by definition) 1 or 2. The complexity of this algorithm is O(n 2 )