Clean up your firewall rules without breaking anything

Firewalls collect stale and overly broad rules over the years, and each one quietly widens what an attacker can reach. Here is a safe, step-by-step way to find them and remove them without breaking what people rely on.

By John E. Phillips ·

By the end of this guide, you'll have a shorter firewall rule base in which every rule has an owner and a reason, the broad "allow anything" rules are narrowed, and you have a routine that keeps it that way.

Who it's for

IT staff, or the provider who manages your network, at a small or mid-size organization with one or more firewalls that have been running for a few years. You'll need admin access to the firewall, its traffic logs, and a change window. Plan on half a day for the first pass over a few hundred rules, plus a few weeks of waiting before anything is deleted.

Why bother: rules are easy to add and nobody likes removing them. Over time the rule base fills with temporary access that never ended, servers that no longer exist and "any" rules added to make something work quickly. Each one is a door that stays open.

Steps

  1. Back up, then export the rules with their hit counts

    Take a full configuration backup first; it's your rollback. Then export the rule base to a spreadsheet, including each rule's hit count and last-hit date if your firewall records them. Check how long the counters have been counting: many firewalls reset them on reboot, upgrade or failover. You want at least 90 days of data, covering a month-end and ideally a quarter-end.

  2. Give every rule an owner and a reason

    Add three columns to the spreadsheet: owner, purpose and ticket or date. Fill in what you can from rule names, comments and memory, and ask around for the rest. Any rule nobody can explain goes on the candidate list.

  3. Find the problem rules

    Go through the export and mark rules that are:

    • Unused: zero hits over the whole counting period.
    • Shadowed or duplicated: never reached, because an earlier rule already matches the same traffic. Many firewalls and their management tools can flag these for you.
    • Too broad: "any" as the source, destination or service, above all on traffic coming in from the internet.
    • Temporary that became permanent: comments such as "temp", "test", a vendor's name or a date long past.
    • Pointing at things that are gone: addresses or objects for retired servers, old offices or former partners.
    • Exposing management: SSH, remote desktop or the firewall's own admin page reachable from the internet. Fix these first.
  4. Narrow the broad rules using the logs

    For each "any" rule that is genuinely in use, turn on logging for it if it's off, and look at what traffic actually matches over a week or two. Then replace it with a rule that allows only those sources, destinations and ports. Keep the old rule disabled just below the new one until you're sure nothing else needed it.

  5. Disable first, delete later

    In a change window, disable the candidate rules rather than deleting them, in small batches, and record which ones you disabled and when. Make sure denied traffic is logged, so anything that breaks shows up as a blocked connection you can trace back to a rule. Tell the help desk what changed. After two to four weeks, including a month-end, delete the rules that nobody missed, along with any NAT rules and address objects that only they used.

  6. Keep it clean

    From now on, require an owner, a purpose and a ticket for every new rule, and an expiry date for anything temporary. Put a rule-base review in the calendar every six months, and repeat steps 1 to 5 using the same spreadsheet.

Check it worked

Compare the rule count before and after, and confirm every remaining rule has an owner and a purpose. Check the deny logs and help-desk tickets from the waiting period for anything legitimate that was blocked. Then, from a computer outside your network, scan your own public addresses (for example with nmap) and confirm only the services you expect, such as your website and mail, answer. Scan only addresses you own, and check your internet or cloud provider's terms first.

Common mistakes

Want a second pair of eyes on your rule base?

Rule-base and remote-access reviews are part of ISMC's Secure Infrastructure & Topology practice. We can review yours, plan the cleanup with you, and stay on hand during the change window.

Request a consultation
← All guides