From 3e1328c83b2d6fe9b444df1b13a74738a3c78123 Mon Sep 17 00:00:00 2001 From: Alexander Koeppe Date: Sun, 15 May 2016 22:30:07 +0200 Subject: [PATCH 1/4] split PF config files between all- and multi port --- config/action.d/pf-allports.conf | 73 +++++++++++++++++++ .../action.d/{pf.conf => pf-multiport.conf} | 6 -- 2 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 config/action.d/pf-allports.conf rename config/action.d/{pf.conf => pf-multiport.conf} (95%) diff --git a/config/action.d/pf-allports.conf b/config/action.d/pf-allports.conf new file mode 100644 index 00000000..e77bea43 --- /dev/null +++ b/config/action.d/pf-allports.conf @@ -0,0 +1,73 @@ +# Fail2Ban configuration file +# +# OpenBSD pf ban/unban +# +# Author: Nick Hilliard +# Modified by: Alexander Koeppe making PF work seamless and with IPv4 and IPv6 +# +# + +[Definition] + +# Option: actionstart +# Notes.: command executed once at the start of Fail2Ban. +# Values: CMD +# +# we don't enable PF automatically; to enable run pfctl -e +# or add `pf_enable="YES"` to /etc/rc.conf (tested on FreeBSD) +actionstart = echo "table <-> persist counters" | pfctl -f- + echo "block proto from <-> to any" | pfctl -f- + + +# Option: actionstop +# Notes.: command executed once at the end of Fail2Ban +# Values: CMD +# +# we only disable PF rules we've installed prior +actionstop = pfctl -sr 2>/dev/null | grep -v - | pfctl -f- + pfctl -t - -T flush + pfctl -t - -T kill + + +# Option: actioncheck +# Notes.: command executed once before each actionban command +# Values: CMD +# +actioncheck = pfctl -sr | grep -q - + + +# Option: actionban +# Notes.: command executed when banning an IP. Take care that the +# command is executed with Fail2Ban user rights. +# Tags: IP address +# number of failures +#