192 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Donald Yandt
|
|
|
4 |
# Because of the --remove-rules in stop this action requires firewalld-0.3.8+
|
|
|
5 |
|
|
|
6 |
[INCLUDES]
|
|
|
7 |
|
|
|
8 |
before = firewallcmd-common.conf
|
|
|
9 |
|
|
|
10 |
[Definition]
|
|
|
11 |
|
|
|
12 |
actionstart = firewall-cmd --direct --add-chain <family> filter f2b-<name>
|
|
|
13 |
firewall-cmd --direct --add-rule <family> filter f2b-<name> 1000 -j RETURN
|
193 |
- |
14 |
firewall-cmd --direct --add-rule <family> filter <chain> 0 -m conntrack --ctstate NEW -p <protocol> -m multiport --dports "$(echo '<port>' | sed s/:/-/g)" -j f2b-<name>
|
192 |
- |
15 |
|
193 |
- |
16 |
actionstop = firewall-cmd --direct --remove-rule <family> filter <chain> 0 -m conntrack --ctstate NEW -p <protocol> -m multiport --dports "$(echo '<port>' | sed s/:/-/g)" -j f2b-<name>
|
192 |
- |
17 |
firewall-cmd --direct --remove-rules <family> filter f2b-<name>
|
|
|
18 |
firewall-cmd --direct --remove-chain <family> filter f2b-<name>
|
|
|
19 |
|
|
|
20 |
# Example actioncheck: firewall-cmd --direct --get-chains ipv4 filter | sed -e 's, ,\n,g' | grep -q '^f2b-apache-modsecurity$'
|
|
|
21 |
|
|
|
22 |
actioncheck = firewall-cmd --direct --get-chains <family> filter | sed -e 's, ,\n,g' | grep -q '^f2b-<name>$'
|
|
|
23 |
|
|
|
24 |
actionban = firewall-cmd --direct --add-rule <family> filter f2b-<name> 0 -s <ip> -j <blocktype>
|
|
|
25 |
|
|
|
26 |
actionunban = firewall-cmd --direct --remove-rule <family> filter f2b-<name> 0 -s <ip> -j <blocktype>
|