Subversion Repositories configs

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 - 1
# Fail2Ban configuration file
2
#
3
# Because of the --remove-rules in stop this action requires firewalld-0.3.8+
4
 
5
[INCLUDES]
6
 
34 - 7
before = iptables-common.conf
5 - 8
 
9
[Definition]
10
 
34 - 11
actionstart = firewall-cmd --direct --add-chain ipv4 filter f2b-<name>
12
              firewall-cmd --direct --add-rule ipv4 filter f2b-<name> 1000 -j RETURN
13
              firewall-cmd --direct --add-rule ipv4 filter <chain> 0 -m state --state NEW -p <protocol> -m multiport --dports <port> -j f2b-<name>
5 - 14
 
34 - 15
actionstop = firewall-cmd --direct --remove-rule ipv4 filter <chain> 0 -m state --state NEW -p <protocol> -m multiport --dports <port> -j f2b-<name>
16
             firewall-cmd --direct --remove-rules ipv4 filter f2b-<name>
17
             firewall-cmd --direct --remove-chain ipv4 filter f2b-<name>
5 - 18
 
34 - 19
actioncheck = firewall-cmd --direct --get-chains ipv4 filter | grep -q 'f2b-<name>$'
5 - 20
 
34 - 21
actionban = firewall-cmd --direct --add-rule ipv4 filter f2b-<name> 0 -s <ip> -j <blocktype>
5 - 22
 
34 - 23
actionunban = firewall-cmd --direct --remove-rule ipv4 filter f2b-<name> 0 -s <ip> -j <blocktype>
5 - 24
 
25
[Init]
26
 
27
# Option:  chain
28
# Notes    specifies the iptables chain to which the fail2ban rules should be
29
#          added
30
# Values:  [ STRING ]
31
#
32
chain = INPUT_direct
33
 
34
# DEV NOTES:
35
#
36
# Author: Edgar Hoch
37
# Copied from iptables-new.conf and modified for use with firewalld by Edgar Hoch.
38
#  It uses "firewall-cmd" instead of "iptables".
39
#
40
# Output:
41
#
42
# $ firewall-cmd --direct --add-chain ipv4 filter fail2ban-name
43
# success
44
# $ firewall-cmd --direct --add-rule ipv4 filter fail2ban-name 1000 -j RETURN
45
# success
34 - 46
# $ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -m state --state NEW -p tcp -m multiport --dports 22 -j fail2ban-name
5 - 47
# success
48
# $ firewall-cmd --direct --get-chains ipv4 filter
49
# fail2ban-name
50
# $ firewall-cmd --direct --get-chains ipv4 filter  | od -h
51
# 0000000 6166 6c69 6232 6e61 6e2d 6d61 0a65
52
# $ firewall-cmd --direct --get-chains ipv4 filter | grep -Eq 'fail2ban-name( |$)' ; echo $?
53
# 0
54
# $ firewall-cmd -V
55
# 0.3.8
56