Firewall Rules Best Practices
12 days agoFirewalls can be simple and it can be complicated. Most people think that Firewall rules are just rules that block or allow packets from entering or leaving an interface. But it...
Firewalls can be simple and it can be complicated. Most people think that Firewall rules are just rules that block or allow packets from entering or leaving an interface. But it is way more than that. There are some very important best practices to follow to achieve reliable performance. Remember it is not just about blocking – it is also about performance, efficiency and of course keeping track of what is happening on your firewall.
Here are some best practices for setting up your firewall rules:
1. “Stealth” rule. Basically a rule that block attempts to access your firewall and of course log them. Set at the WAN interface. Use drop since they should not be legitimate attempts. No one outside of the network should be attempting to hit the firewall. Some users do need access to the firewall from the WAN though but there are plenty of other ways to get access to the firewall from the Internet.
2. “Cleanup” rule. Although not very important, it is a “good-to-have” kind of rule. Set at LAN interface. It is meant to block all other traffic and should be at the bottom of your rulebase. However most modern capable firewalls are implicitly blocking all traffic other than the ones which you specially allow. But it is good, since you can then log all other unwanted attempts. Also good for tracking weird traffic on your LAN.
3. IP Spoofing rule. Basically rules that ensure no spoofed IP addresses are able to enter or leave the network. Frequently a lot of spyware or viruses “spoof” IP addresses to trick firewalls into thinking that they are legitimate traffic. Drop all private IP addresses at the WAN and other than your LAN IP range, drop all other IP addresses at the LAN. You should also track these traffic at the LAN.
4. Performance. Ensure that those frequently accessed rules are at the top. Remember firewall rules are read from top to bottom. So to improve performance, make sure the top rules are the ones that are frequently used. Imagine if you have 100 rules and each packet have to go from top to bottom, it will definitely slow down your traffic, no matter what kind of high performance firewall you have. Always remember the “top down” approach.
5. Reject or Drop? Not all traffic you want to block are “bad” or malicious. Some are merely things that you don’t want to get out or get it. They might have their purposes in the grand scheme of things. These packets should be rejected so that they won’t keep on attempting to retry. If you drop some of these packets, they might keep on retrying, which will slow down the firewall. Take for example, you want to block all outgoing DNS traffic to a certain DNS server, it might be better to reject these traffic instead of dropping. However there are certain things which you want to drop, especially the ones that come from the WAN side. This is kind of like trying to “stealth” your WAN from hostile attackers and they usually probe and go.
6. Simple is better. Honestly. Your firewall and everyone in your LAN will thank you for it. Don’t have like 10 rules doing the same thing. Bogs down the firewall. And 100 rules can be very hard to administer and is very prone to errors.
7. Check and review the rules regularly. Firewall Administrators might be pressured to quickly act on certain exploits and they have to do it fast. Thus the rules that were entered might not be optimized. Thus it is a good idea to review the rules with a clearer head. Not to mention, some unused rules can be checked and removed if needed.
8. Avoid the “ANY” rule. This is one of the fundamentals in firewall management. Never allow “ANY” traffic to come in as it can be rather dangerous. Should not even allow “ANY” traffic to leave! A good idea is to reject all traffic first and ONLY allow certain traffic to come in (and leave). However most modern capable firewalls should implicitly block traffic at the interfaces already.
9. Document and keep track of all changes made to the firewall rules. Have a good description for the rules help a lot.
10. Update (patch) your firewall. Always patch your firewall application. There might be bugs or exploits that attackers can make use to access or bypass the firewall. And since it is an ongoing battle, it might not be a good idea to ignore and think that you are always safe. Most manufacturers will release patches regularly to help combat new threats as well. Surprisingly, there are quite a lot of administrators who do not update (or patch) their firewalls because they feel it is rather troublesome.
11. Backup firewall configurations. Underneath it all, a firewall is still a device and it can break down. Just imagine all the hardwork you have done setting up the rules and settings, only to have it down the drain in just a few seconds. Always backup your firewall configurations once you have made changes to it. Or even before you make any changes. Just like everything in the IT world, always have a working backup.




































