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 |
|
|
|
7 |
[INCLUDES]
|
|
|
8 |
|
|
|
9 |
before = firewallcmd-common.conf
|
|
|
10 |
|
|
|
11 |
[Definition]
|
|
|
12 |
|
|
|
13 |
actionstart = firewall-cmd --direct --add-chain <family> filter f2b-<name>
|
|
|
14 |
firewall-cmd --direct --add-rule <family> filter f2b-<name> 1000 -j RETURN
|
|
|
15 |
firewall-cmd --direct --add-rule <family> filter <chain> 0 -j f2b-<name>
|
|
|
16 |
|
|
|
17 |
actionstop = firewall-cmd --direct --remove-rule <family> filter <chain> 0 -j f2b-<name>
|
|
|
18 |
firewall-cmd --direct --remove-rules <family> filter f2b-<name>
|
|
|
19 |
firewall-cmd --direct --remove-chain <family> filter f2b-<name>
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
# Example actioncheck: firewall-cmd --direct --get-chains ipv4 filter | sed -e 's, ,\n,g' | grep -q '^f2b-recidive$'
|
|
|
23 |
|
|
|
24 |
actioncheck = firewall-cmd --direct --get-chains <family> filter | sed -e 's, ,\n,g' | grep -q '^f2b-<name>$'
|
|
|
25 |
|
|
|
26 |
actionban = firewall-cmd --direct --add-rule <family> filter f2b-<name> 0 -s <ip> -j <blocktype>
|
|
|
27 |
|
|
|
28 |
actionunban = firewall-cmd --direct --remove-rule <family> filter f2b-<name> 0 -s <ip> -j <blocktype>
|
|
|
29 |
|
|
|
30 |
# DEV NOTES:
|
|
|
31 |
#
|
|
|
32 |
# Author: Donald Yandt
|
|
|
33 |
# Uses "FirewallD" instead of the "iptables daemon".
|
|
|
34 |
#
|
|
|
35 |
#
|
|
|
36 |
# Output:
|
|
|
37 |
|
|
|
38 |
# actionstart:
|
|
|
39 |
# $ firewall-cmd --direct --add-chain ipv4 filter f2b-recidive
|
|
|
40 |
# success
|
|
|
41 |
# $ firewall-cmd --direct --add-rule ipv4 filter f2b-recidive 1000 -j RETURN
|
|
|
42 |
# success
|
|
|
43 |
# $ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -j f2b-recidive
|
|
|
44 |
# success
|
|
|
45 |
|