You could also use the hit counts from ipfstat -inh to reorganize the rules within group 20 so the most frequent offenders are at the top of the list and thus dropped with less processing overhead (as long as 'quick' is used).
Bob At 01:13 PM 11/13/02 -0500, James A. Robbins wrote:
We use groups extensively and the above rules can be simplified quite a bit. You also need to use the "block in quick" syntax to keep the packets that go into the group from also continuing on through your other rules. You also need to continue to use the "quick" option for all the rules in the group. If you forget and do not use it the "quick" toggle will be reset and the packets will continue to be processed by the rules following your group. Since the filter to get into the group already limits where the packet comes from and its protocol you really don't need to check all that again. I think the following would suffice: block in quick on hme0 proto tcp from any to any port 80 flags S/SA head 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 block in quick from <offender>/32 to any group 20 ... pass in quick from any to <legitimate port 80 receivers on your network> group 20 (at this point all other group 20 traffic is dropped) (put your other non-port 80 rules here without the group 20 suffix) If you wish you can also include the "log" option in the above rules to keep track of when they are used, although in this case just getting the hit counts from ipfstat might be sufficient. With that info you could probably automatically remove those rules that have not received a hit in a reasonable amount of time. -- James A. Robbins Network Engineer The Ohio State University Chemistry Department
