2009/12/21 Gaurav Ghimire <gau...@subisu.net.np>: > Hi all, > > Are there any possibilities that I could run a script (bash, perl) when > any rule is matched. > > For example, I have some distinct rule and want to get an alert email > each time any connection threshold is crossed on it from a singe IP. Say > I want one IP only have 1 http connection to a web service in my server, > if it goes 2 pf would update a table or run a external script that would > alert me about that IP.
For tracking source IPs and adding them to a table, you can already do this, c.f. max-src-conn and overload in the pf.conf man page. If you use the overload keyword to dump the bad IPs into a table then as a quick and dirty solution for scripting you can the run a script from cron every few minutes to do something like: pfctl -t table_name_with_bad_ips -T show Just a quick warning in advance though, you're going to need a lot more than just 1 allowed tcp connection per source IP to get an HTTP service working properly, unless you want your web sites to be practically unusable. Personally, I'd set it to around 30 at first then see how it goes - no normal usage should hit this, only a badly configured robot. Remember you're allowing for both users' browsers using more than one connection at a time and the possibility of a single source IP having many clients NAT'ed behind it. _______________________________________________ freebsd-pf@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-pf To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"