Subversion Repositories configs

Rev

Go to most recent revision | Details | 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
 
7
before = iptables-blocktype.conf
8
 
9
[Definition]
10
 
11
actionstart = firewall-cmd --direct --add-chain ipv4 filter fail2ban-<name>
12
              firewall-cmd --direct --add-rule ipv4 filter fail2ban-<name> 1000 -j RETURN
13
              firewall-cmd --direct --add-rule ipv4 filter <chain> 0 -m state --state NEW -p <protocol> --dport <port> -j fail2ban-<name>
14
 
15
actionstop = firewall-cmd --direct --remove-rule ipv4 filter <chain> 0 -m state --state NEW -p <protocol> --dport <port> -j fail2ban-<name>
16
             firewall-cmd --direct --remove-rules ipv4 filter fail2ban-<name>
17
             firewall-cmd --direct --remove-chain ipv4 filter fail2ban-<name>
18
 
19
actioncheck = firewall-cmd --direct --get-chains ipv4 filter | grep -q '^fail2ban-<name>$'
20
 
21
actionban = firewall-cmd --direct --add-rule ipv4 filter fail2ban-<name> 0 -s <ip> -j <blocktype>
22
 
23
actionunban = firewall-cmd --direct --remove-rule ipv4 filter fail2ban-<name> 0 -s <ip> -j <blocktype>
24
 
25
[Init]
26
 
27
# Default name of the chain
28
#
29
name = default
30
 
31
# Option:  port
32
# Notes.:  specifies port to monitor
33
# Values:  [ NUM | STRING ]
34
#
35
port = ssh
36
 
37
# Option:  protocol
38
# Notes.:  internally used by config reader for interpolations.
39
# Values:  [ tcp | udp | icmp | all ]
40
#
41
protocol = tcp
42
 
43
# Option:  chain
44
# Notes    specifies the iptables chain to which the fail2ban rules should be
45
#          added
46
# Values:  [ STRING ]
47
#
48
chain = INPUT_direct
49
 
50
# DEV NOTES:
51
#
52
# Author: Edgar Hoch
53
# Copied from iptables-new.conf and modified for use with firewalld by Edgar Hoch.
54
#  It uses "firewall-cmd" instead of "iptables".
55
#
56
# Output:
57
#
58
# $ firewall-cmd --direct --add-chain ipv4 filter fail2ban-name
59
# success
60
# $ firewall-cmd --direct --add-rule ipv4 filter fail2ban-name 1000 -j RETURN
61
# success
62
# $ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -m state --state NEW -p tcp --dport 22 -j fail2ban-name
63
# success
64
# $ firewall-cmd --direct --get-chains ipv4 filter
65
# fail2ban-name
66
# $ firewall-cmd --direct --get-chains ipv4 filter  | od -h
67
# 0000000 6166 6c69 6232 6e61 6e2d 6d61 0a65
68
# $ firewall-cmd --direct --get-chains ipv4 filter | grep -Eq 'fail2ban-name( |$)' ; echo $?
69
# 0
70
# $ firewall-cmd -V
71
# 0.3.8
72