Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 - 1
# Fail2Ban configuration file
2
#
3
# Author: Daniel Black
4
# Author: Cyril Jaquier
5
# Modified: Yaroslav O. Halchenko <debian@onerussian.com>
6
# 			made active on all ports from original iptables.conf
7
# Modified: Alexander Belykh <albel727@ngs.ru>
8
#                       adapted for nftables
9
#
10
# This is a included configuration file and includes the definitions for the nftables
11
# used in all nftables based actions by default.
12
#
13
# The user can override the defaults in nftables-common.local
14
 
15
[INCLUDES]
16
 
17
after = nftables-common.local
18
 
19
[Definition]
20
 
21
# Option:  nftables_mode
22
# Notes.:  additional expressions for nftables filter rule
23
# Values:  nftables expressions
24
#
25
nftables_mode = <protocol> dport \{ <port> \}
26
 
27
# Option:  actionstart
28
# Notes.:  command executed once at the start of Fail2Ban.
29
# Values:  CMD
30
#
31
actionstart = <nftables> add set <nftables_family> <nftables_table> f2b-<name> \{ type <nftables_type>\; \}
32
              <nftables> insert rule <nftables_family> <nftables_table> <chain> %(nftables_mode)s ip saddr @f2b-<name> <blocktype>
33
 
34
_nft_list = <nftables> --handle --numeric list chain <nftables_family> <nftables_table> <chain>
35
_nft_get_handle_id = grep -m1 'ip saddr @f2b-<name> <blocktype> # handle' | grep -oe ' handle [0-9]*'
36
 
37
# Option:  actionstop
38
# Notes.:  command executed once at the end of Fail2Ban
39
# Values:  CMD
40
#
41
actionstop = HANDLE_ID=$(%(_nft_list)s | %(_nft_get_handle_id)s)
42
             <nftables> delete rule <nftables_family> <nftables_table> <chain> $HANDLE_ID
43
             <nftables> delete set <nftables_family> <nftables_table> f2b-<name>
44
 
45
# Option:  actioncheck
46
# Notes.:  command executed once before each actionban command
47
# Values:  CMD
48
#
49
actioncheck = <nftables> list chain <nftables_family> <nftables_table> <chain> | grep -q '@f2b-<name>[ \t]'
50
 
51
# Option:  actionban
52
# Notes.:  command executed when banning an IP. Take care that the
53
#          command is executed with Fail2Ban user rights.
54
# Tags:    See jail.conf(5) man page
55
# Values:  CMD
56
#
57
actionban = <nftables> add element <nftables_family> <nftables_table> f2b-<name> \{ <ip> \}
58
 
59
# Option:  actionunban
60
# Notes.:  command executed when unbanning an IP. Take care that the
61
#          command is executed with Fail2Ban user rights.
62
# Tags:    See jail.conf(5) man page
63
# Values:  CMD
64
#
65
actionunban = <nftables> delete element <nftables_family> <nftables_table> f2b-<name> \{ <ip> \}
66
 
67
[Init]
68
 
69
# Option:  nftables_type
70
# Notes.:  address type to work with
71
# Values:  [ipv4_addr | ipv6_addr]  Default: ipv4_addr
72
#
73
nftables_type = ipv4_addr
74
 
75
# Option:  nftables_family
76
# Notes.:  address family to work in
77
# Values:  [ip | ip6 | inet]  Default: inet
78
#
79
nftables_family = inet
80
 
81
# Option:  nftables_table
82
# Notes.:  table in the address family to work in
83
# Values:  STRING  Default: filter
84
#
85
nftables_table = filter
86
 
87
# Option:  chain
88
# Notes    specifies the nftables chain to which the Fail2Ban rules should be
89
#          added
90
# Values:  STRING  Default: input
91
chain = input
92
 
93
# Default name of the filtering set
94
#
95
name = default
96
 
97
# Option:  port
98
# Notes.:  specifies port to monitor
99
# Values:  [ NUM | STRING ]  Default:
100
#
101
port = ssh
102
 
103
# Option:  protocol
104
# Notes.:  internally used by config reader for interpolations.
105
# Values:  [ tcp | udp ] Default: tcp
106
#
107
protocol = tcp
108
 
109
# Option:  blocktype
110
# Note:    This is what the action does with rules. This can be any jump target
111
#          as per the nftables man page (section 8). Common values are drop
112
#          reject, reject with icmp type host-unreachable
113
# Values:  STRING
114
blocktype = reject
115
 
116
# Option:  nftables
117
# Notes.:  Actual command to be executed, including common to all calls options
118
# Values:  STRING
119
nftables = nft