max-src-nodes <number>Limits the maximum number of source addresses which can simultaneously have state table entries.max-src-states <number>Limits the maximum number of simultaneous state entries that a single source address can create with this rule.For stateful TCP connections, limits on established connections (connections which have completed the TCP 3-way handshake) can also be enforced per source IP.max-src-conn <number>Limits the maximum number of simultaneous TCP connections which have completed the 3-way handshake that a single host can make.max-src-conn-rate <number> / <seconds>Limit the rate of new connections over a time interval. The connection rate is an approximation calculated as a moving average.
table <virusprot>
block in log quick from {<virusprot>} to {any} label "8e36..." # virusprot overload table
max-src-conn 1 max-src-states 10 tcp.established 120 max-src-conn-rate 1 /1, overload <virusprot> flush global
Because the 3-way handshake ensures that the source address is not being spoofed, more aggressive action can be taken based on these limits. With the overload <table> state option, source IP addresses which hit either of the limits on established connections will be added to the named table. This table can be used in the ruleset to block further activity from the offending host, redirect it to a tarpit process, or restrict its bandwidth.The optional flush keyword kills all states created by the matching rule which originate from the host which exceeds these limits. The global modifier to the flush command kills all states originating from the offending host, regardless of which rule created the state.For example, the following rules will protect the webserver against hosts making more than 100 connections in 10 seconds. Any host which connects faster than this rate will have its address added to the <bad_hosts> table and have all states originating from it flushed. Any new packets arriving from this host will be dropped unconditionally by the block rule. block quick from <bad_hosts> pass in on $ext_if proto tcp to $webserver port www keep state \ (max-src-conn-rate 100/10, overload <bad_hosts> flush global)[/code]