Auditing permissive rules

Find what should not get through

Lesson 16 of 20 · 12 min · Module 5: Troubleshooting

Blocked traffic gets reported within minutes. Traffic that is allowed by mistake is reported by nobody, until the day it is used.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Read an allow rule for the widest traffic it permits
  • Compare what a rule does with what it was meant to do
  • Tighten a rule without breaking its purpose

The idea

An audit reads the policy from the other side: for every allow rule, what is the widest thing this permits? The usual findings are any as a source where one host was meant, a missing port, and a rule whose comment promises less than the rule allows.

# comment says: backups for the backup server
allow tcp from any to servers port 873      # the rule says: backups from anywhere

01Read every allow rule at its widest

Do not read a rule as its author meant it. Read it as an attacker would: which is the least expected source, destination and port that still match? "from any" includes the guest Wi-Fi and, on an internet-facing device, the whole world.

02Compare with the stated purpose

Each rule should have a reason: a comment, a ticket, an owner. Where the rule allows more than the reason, tighten it to the reason. Where there is no reason at all, find the owner before it becomes permanent.

03Check that the purpose survived

After tightening, the traffic the rule was written for must still pass. An audit that breaks production gets its changes rolled back, including the good ones.

Your turn

Audit this policy. The comments say what each rule was meant to do; two rules allow far more. Tighten them: SSH to servers is for admin only, and the office needs the website on web over tcp 443 only. Leave the other two rules as they are.

What the checks look for

  • SSH to the servers is for the administrator only
  • The office reaches the website over HTTPS and nothing else on it
  • The application still reaches its database
  • The rules that were correct are unchanged
Try it in the editor →

Take this with you

Audit allow rules at their widest reading, tighten them to their stated purpose, and confirm the purpose still works.

Go a little further

Look at the last rule: with the tightened policy and default deny, is it still needed? Decide what it adds, and what adding log to it would give you.

Learn Firewall Foundations for free

20 short lessons with real code and instant checks.

See the whole course →