Starting to extract blacklist logic
Adds historical blacklisting.

Once an actor is blacklisted and goes away for the expire period, their
records are removed. It is nice to be able to keep a list of actors who
have been blacklisted. If the actor returns and triggers any ModSecurity
rule even once, they are blacklisted again based on this list.

Signed-off-by: Aaron Bedra <aaron@aaronbedra.com>
Make the threshold check more efficient.

Instead of calling ZSCORE for each actor, simply add the WITHSCORES
option to the ZRANGE call and do the comparison. This saves (n - m) calls to
Redis where n is the number of offenders and m is the number of
historically blacklisted actors.

Signed-off-by: Aaron Bedra <aaron@aaronbedra.com>
Fully extracting blacklist_and_expire()

Since the OFDP blacklisting uses the same methods for expiry and should
also add to the historical blacklist entries, the blacklist_and_expire
function was pulled out to a common place for reuse.

Some minor formatting cleanup was done as well.

Signed-off-by: Aaron Bedra <aaron@aaronbedra.com>
Version bump
Merge tag '1.4.0' into debian

1.4.0