Subversion Repositories ALCASAR

Rev

Rev 2355 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2355 Rev 2357
1
#!/bin/sh
1
#!/bin/sh
2
# $Id: fail2ban.sh 2355 2017-07-26 22:11:27Z tom.houdayer $
2
# $Id: fail2ban.sh 2357 2017-07-27 14:29:28Z tom.houdayer $
3
 
3
 
4
FAIL_CONF="/etc/fail2ban/fail2ban.conf"
4
FAIL_CONF="/etc/fail2ban/fail2ban.conf"
5
JAIL_CONF="/etc/fail2ban/jail.conf"
5
JAIL_CONF="/etc/fail2ban/jail.conf"
6
DIR_FILTER="/etc/fail2ban/filter.d/"
6
DIR_FILTER="/etc/fail2ban/filter.d/"
7
ACTION_ALLPORTS="/etc/fail2ban/action.d/iptables-allports.conf"
7
ACTION_ALLPORTS="/etc/fail2ban/action.d/iptables-allports.conf"
8
 
8
 
9
#########################################################
9
#########################################################
10
## Mise à jour du fichier de configuration de fail2ban ##
10
## Mise à jour du fichier de configuration de fail2ban ##
11
#########################################################
11
#########################################################
12
[ -f $FAIL_CONF ] && [ ! -e $FAIL_CONF.default ] && mv $FAIL_CONF $FAIL_CONF.default
12
[ -f $FAIL_CONF ] && [ ! -e $FAIL_CONF.default ] && mv $FAIL_CONF $FAIL_CONF.default
13
cat << EOF > $FAIL_CONF
13
cat << EOF > $FAIL_CONF
14
 
14
 
15
[Definition]
15
[Definition]
16
 
16
 
17
# Option:  loglevel
17
# Option:  loglevel
18
# Notes.:  Set the log level output.
18
# Notes.:  Set the log level output.
19
#          1 = ERROR
19
#          1 = ERROR
20
#          2 = WARN
20
#          2 = WARN
21
#          3 = INFO
21
#          3 = INFO
22
#          4 = DEBUG
22
#          4 = DEBUG
23
# Values:  NUM  Default:  3
23
# Values:  NUM  Default:  3
24
#
24
#
25
loglevel = 3
25
loglevel = 3
26
 
26
 
27
# Option:  logtarget
27
# Option:  logtarget
28
# Notes.:  Set the log target. This could be a file, SYSLOG, STDERR or STDOUT.
28
# Notes.:  Set the log target. This could be a file, SYSLOG, STDERR or STDOUT.
29
#          Only one log target can be specified.
29
#          Only one log target can be specified.
30
# Values:  STDOUT STDERR SYSLOG file  Default:  /var/log/fail2ban.log
30
# Values:  STDOUT STDERR SYSLOG file  Default:  /var/log/fail2ban.log
31
#
31
#
32
logtarget = /var/log/fail2ban.log
32
logtarget = /var/log/fail2ban.log
33
 
33
 
34
# Option: socket
34
# Option: socket
35
# Notes.: Set the socket file. This is used to communicate with the daemon. Do
35
# Notes.: Set the socket file. This is used to communicate with the daemon. Do
36
#         not remove this file when Fail2ban runs. It will not be possible to
36
#         not remove this file when Fail2ban runs. It will not be possible to
37
#         communicate with the server afterwards.
37
#         communicate with the server afterwards.
38
# Values: FILE  Default:  /var/run/fail2ban/fail2ban.sock
38
# Values: FILE  Default:  /var/run/fail2ban/fail2ban.sock
39
#
39
#
40
socket = /var/run/fail2ban/fail2ban.sock
40
socket = /var/run/fail2ban/fail2ban.sock
41
 
41
 
42
# Option: pidfile
42
# Option: pidfile
43
# Notes.: Set the PID file. This is used to store the process ID of the
43
# Notes.: Set the PID file. This is used to store the process ID of the
44
#         fail2ban server.
44
#         fail2ban server.
45
# Values: [ FILE ]  Default: /var/run/fail2ban/fail2ban.pid
45
# Values: [ FILE ]  Default: /var/run/fail2ban/fail2ban.pid
46
#
46
#
47
pidfile = /var/run/fail2ban/fail2ban.pid
47
pidfile = /var/run/fail2ban/fail2ban.pid
48
EOF
48
EOF
49
 
49
 
50
#########################################################
50
#########################################################
51
## Mise à jour de la configuration de jail de fail2ban ##
51
## Mise à jour de la configuration de jail de fail2ban ##
52
#########################################################
52
#########################################################
53
[ -f $JAIL_CONF ] && [ ! -e $JAIL_CONF.default ] && mv $JAIL_CONF $JAIL_CONF.default
53
[ -f $JAIL_CONF ] && [ ! -e $JAIL_CONF.default ] && mv $JAIL_CONF $JAIL_CONF.default
54
cat << EOF > $JAIL_CONF
54
cat << EOF > $JAIL_CONF
55
 
55
 
56
# Fail2Ban configuration file
56
# Fail2Ban configuration file
57
#
57
#
58
# Author: Cyril Jaquier
58
# Author: Cyril Jaquier
59
# Adapted by ALCASAR team
59
# Adapted by ALCASAR team
60
 
60
 
61
 
61
 
62
# The DEFAULT allows a global definition of the options. They can be overridden
62
# The DEFAULT allows a global definition of the options. They can be overridden
63
# in each jail afterwards.
63
# in each jail afterwards.
64
 
64
 
65
[DEFAULT]
65
[DEFAULT]
66
 
66
 
67
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
67
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
68
# ban a host which matches an address in this list. Several addresses can be
68
# ban a host which matches an address in this list. Several addresses can be
69
# defined using space separator.
69
# defined using space separator.
70
ignoreip = 127.0.0.1/8
70
ignoreip = 127.0.0.1/8
71
 
71
 
72
# "bantime" is the number of seconds that a host is banned.
72
# "bantime" is the number of seconds that a host is banned.
73
bantime  = 300
73
bantime  = 300
74
 
74
 
75
# A host is banned if it has generated "maxretry" during the last "findtime" seconds.
75
# A host is banned if it has generated "maxretry" during the last "findtime" seconds.
76
# Un client est banni s'il génere "maxretry" requêtes pendant "findtime" (en secondes)
76
# Un client est banni s'il génere "maxretry" requêtes pendant "findtime" (en secondes)
77
# Pour ALCASAR : 5 requetes pour chaque filtres en 60 secondes
77
# Pour ALCASAR : 5 requetes pour chaque filtres en 60 secondes
78
findtime  = 60
78
findtime  = 60
79
 
79
 
80
# "maxretry" is the number of failures before a host get banned.
80
# "maxretry" is the number of failures before a host get banned.
81
maxretry = 5
81
maxretry = 5
82
 
82
 
83
# "backend" specifies the backend used to get files modification. Available
83
# "backend" specifies the backend used to get files modification. Available
84
# options are "gamin", "polling" and "auto". This option can be overridden in
84
# options are "gamin", "polling" and "auto". This option can be overridden in
85
# each jail too (use "gamin" for a jail and "polling" for another).
85
# each jail too (use "gamin" for a jail and "polling" for another).
86
#
86
#
87
# gamin:   requires Gamin (a file alteration monitor) to be installed. If Gamin
87
# gamin:   requires Gamin (a file alteration monitor) to be installed. If Gamin
88
#          is not installed, Fail2ban will use polling.
88
#          is not installed, Fail2ban will use polling.
89
# polling: uses a polling algorithm which does not require external libraries.
89
# polling: uses a polling algorithm which does not require external libraries.
90
# auto:    will choose Gamin if available and polling otherwise.
90
# auto:    will choose Gamin if available and polling otherwise.
91
backend = auto
91
backend = auto
92
 
92
 
93
# "usedns" specifies if jails should trust hostnames in logs,
93
# "usedns" specifies if jails should trust hostnames in logs,
94
# warn when DNS lookups are performed, or ignore all hostnames in logs
94
# warn when DNS lookups are performed, or ignore all hostnames in logs
95
#
95
#
96
# yes: if a hostname is encountered, a DNS lookup will be performed.
96
# yes: if a hostname is encountered, a DNS lookup will be performed.
97
# warn: if a hostname is encountered, a DNS lookup will be performed,
97
# warn: if a hostname is encountered, a DNS lookup will be performed,
98
# but it will be logged as a warning.
98
# but it will be logged as a warning.
99
# no: if a hostname is encountered, will not be used for banning,
99
# no: if a hostname is encountered, will not be used for banning,
100
# but it will be logged as info.
100
# but it will be logged as info.
101
usedns = warn
101
usedns = warn
102
 
102
 
103
# Bannissement sur tous les ports après 2 refus d'Apache (tentative d'accès sur des pages inexistentes)
103
# Bannissement sur tous les ports après 2 refus d'Apache (tentative d'accès sur des pages inexistentes)
104
[alcasar_mod-evasive]
104
[alcasar_mod-evasive]
105
 
105
 
106
#enabled = true
106
#enabled = true
107
enabled = false
107
enabled = false
108
filter = alcasar_mod-evasive
108
filter = alcasar_mod-evasive
109
action = iptables-allports[name=alcasar_mod-evasive]
109
action = iptables-allports[name=alcasar_mod-evasive]
110
logpath = /var/log/httpd/error_log
110
logpath = /var/log/httpd/error_log
111
          /var/log/httpd/ssl_error_log
111
          /var/log/httpd/ssl_error_log
112
maxretry = 2
112
maxretry = 2
113
 
113
 
114
# Bannissement sur tout les ports après 3 refus de SSH (tentative d'accès par brute-force)
114
# Bannissement sur tout les ports après 3 refus de SSH (tentative d'accès par brute-force)
115
[ssh-iptables]
115
[ssh-iptables]
116
 
116
 
117
enabled = true
117
enabled = true
118
#enabled  = false
118
#enabled  = false
119
filter   = sshd
119
filter   = sshd
120
action   = iptables-allports[name=SSH]
120
action   = iptables-allports[name=SSH]
121
logpath  = /var/log/auth.log
121
logpath  = /var/log/auth.log
122
maxretry = 3
122
maxretry = 3
123
 
123
 
124
# Bannissement sur tous les ports après 5 échecs de connexion sur le centre de contrôle (ACC)
124
# Bannissement sur tous les ports après 5 échecs de connexion sur le centre de contrôle (ACC)
125
[alcasar_acc]
125
[alcasar_acc]
126
 
126
 
127
enabled = true
127
enabled = true
128
#enabled = false
128
#enabled = false
129
filter = alcasar_acc
129
filter = alcasar_acc
130
action = iptables-allports[name=alcasar_acc]
130
action = iptables-allports[name=alcasar_acc]
131
logpath = /var/log/httpd/ssl_error_log
131
logpath = /var/log/httpd/ssl_error_log
132
maxretry = 5
132
maxretry = 5
133
 
133
 
134
# Bannissement sur tout les ports après 5 echecs de connexion pour un usager
134
# Bannissement sur tout les ports après 5 echecs de connexion pour un usager
135
[alcasar_intercept]
135
[alcasar_intercept]
136
 
136
 
137
enabled = true
137
enabled = true
138
#enabled = false
138
#enabled = false
139
filter = alcasar_intercept
139
filter = alcasar_intercept
140
action = iptables-allports[name=alcasar_intercept]
140
action = iptables-allports[name=alcasar_intercept]
141
logpath = /var/log/httpd/ssl_request_log
141
logpath = /var/log/httpd/ssl_request_log
142
maxretry = 5
142
maxretry = 5
143
 
143
 
144
# Bannissement sur tout les port après 5 échecs de changement de mot de passe
144
# Bannissement sur tout les port après 5 échecs de changement de mot de passe
145
# 5 POST pour changer le mot de passe que le POST soit ok ou non.
145
# 5 POST pour changer le mot de passe que le POST soit ok ou non.
146
[alcasar_change-pwd]
146
[alcasar_change-pwd]
147
 
147
 
148
enabled = true
148
enabled = true
149
#enabled = false
149
#enabled = false
150
filter = alcasar_change-pwd
150
filter = alcasar_change-pwd
151
action = iptables-allports[name=alcasar_change-pwd]
151
action = iptables-allports[name=alcasar_change-pwd]
152
logpath = /var/log/httpd/ssl_request_log
152
logpath = /var/log/httpd/ssl_request_log
153
maxretry = 5
153
maxretry = 5
154
 
154
 
155
EOF
155
EOF
156
 
156
 
157
##################################################
157
##################################################
158
## Mise en place des filtres spécifiques	##
158
## Mise en place des filtres spécifiques	##
159
## - Mod_evasive.conf				##
159
## - Mod_evasive.conf				##
160
## - acc-htdigest.conf				##
160
## - acc-htdigest.conf				##
161
## - intercept.conf				##
161
## - intercept.conf				##
162
## - change-pwd.conf				##
162
## - change-pwd.conf				##
163
##################################################
163
##################################################
164
 
164
 
165
######################
165
######################
166
## MOD-EVASIVE.CONF ##
166
## MOD-EVASIVE.CONF ##
167
######################
167
######################
168
cat << EOF > $DIR_FILTER/alcasar_mod-evasive.conf
168
cat << EOF > $DIR_FILTER/alcasar_mod-evasive.conf
169
# Fail2Ban configuration file
169
# Fail2Ban configuration file
170
#
170
#
171
# Author: Cyril Jaquier
171
# Author: Cyril Jaquier
172
# Adapted by ALCASAR team
172
# Adapted by ALCASAR team
173
 
173
 
174
[Definition]
174
[Definition]
175
 
175
 
176
# Option:  failregex
176
# Option:  failregex
177
# Notes.:  regex to match the password failure messages in the logfile. The
177
# Notes.:  regex to match the password failure messages in the logfile. The
178
#          host must be matched by a group named "host". The tag "<HOST>" can
178
#          host must be matched by a group named "host". The tag "<HOST>" can
179
#          be used for standard IP/hostname matching and is only an alias for
179
#          be used for standard IP/hostname matching and is only an alias for
180
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
180
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
181
# Values:  TEXT
181
# Values:  TEXT
182
#
182
#
183
failregex =  \[client <HOST>:[0-9]+\] .*client denied by server configuration
183
failregex =  \[client <HOST>:[0-9]+\] .*client denied by server configuration
184
 
184
 
185
# Option:  ignoreregex
185
# Option:  ignoreregex
186
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
186
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
187
# Values:  TEXT
187
# Values:  TEXT
188
#
188
#
189
ignoreregex = 
189
ignoreregex = 
190
EOF
190
EOF
191
 
191
 
192
#######################
192
#######################
193
## ACC-HTDIGEST.CONF ##
193
## ACC-HTDIGEST.CONF ##
194
#######################
194
#######################
195
cat << EOF > $DIR_FILTER/alcasar_acc.conf
195
cat << EOF > $DIR_FILTER/alcasar_acc.conf
196
# Fail2Ban configuration file
196
# Fail2Ban configuration file
197
#
197
#
198
# Author: Cyril Jaquier
198
# Author: Cyril Jaquier
199
# Adapted by ALCASAR team
199
# Adapted by ALCASAR team
200
 
200
 
201
[Definition]
201
[Definition]
202
 
202
 
203
# Option:  failregex
203
# Option:  failregex
204
# Notes.:  regex to match the password failure messages in the logfile. The
204
# Notes.:  regex to match the password failure messages in the logfile. The
205
#          host must be matched by a group named "host". The tag "<HOST>" can
205
#          host must be matched by a group named "host". The tag "<HOST>" can
206
#          be used for standard IP/hostname matching and is only an alias for
206
#          be used for standard IP/hostname matching and is only an alias for
207
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
207
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
208
# Values:  TEXT
208
# Values:  TEXT
209
#
209
#
210
failregex =  \[auth_digest:error\] \[client <HOST>:[0-9]+\] .*ALCASAR Control Center \(ACC\)
210
failregex =  \[auth_digest:error\] \[client <HOST>:[0-9]+\] .*ALCASAR Control Center \(ACC\)
211
 
211
 
212
#[[]auth_digest:error[]] [[]client <HOST>:[0-9]\{1,5\}[]]
212
#[[]auth_digest:error[]] [[]client <HOST>:[0-9]\{1,5\}[]]
213
 
213
 
214
# Option:  ignoreregex
214
# Option:  ignoreregex
215
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
215
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
216
# Values:  TEXT
216
# Values:  TEXT
217
#
217
#
218
ignoreregex = 
218
ignoreregex = 
219
EOF
219
EOF
220
 
220
 
221
####################
221
####################
222
## INTERCEPT.CONF ##
222
## INTERCEPT.CONF ##
223
####################
223
####################
224
cat << EOF > $DIR_FILTER/alcasar_intercept.conf
224
cat << EOF > $DIR_FILTER/alcasar_intercept.conf
225
# Fail2Ban configuration file
225
# Fail2Ban configuration file
226
#
226
#
227
# Author: Cyril Jaquier
227
# Author: Cyril Jaquier
228
# Adapted by ALCASAR team
228
# Adapted by ALCASAR team
229
 
229
 
230
[Definition]
230
[Definition]
231
 
231
 
232
# Option:  failregex
232
# Option:  failregex
233
# Notes.:  regex to match the password failure messages in the logfile. The
233
# Notes.:  regex to match the password failure messages in the logfile. The
234
#          host must be matched by a group named "host". The tag "<HOST>" can
234
#          host must be matched by a group named "host". The tag "<HOST>" can
235
#          be used for standard IP/hostname matching and is only an alias for
235
#          be used for standard IP/hostname matching and is only an alias for
236
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
236
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
237
# Values:  TEXT
237
# Values:  TEXT
238
#
238
#
239
failregex = \[<HOST>\] \"GET \/intercept\.php\?res=failed\&reason=reject
239
failregex = \[<HOST>\] \"GET \/intercept\.php\?res=failed\&reason=reject
240
 
240
 
241
# Option:  ignoreregex
241
# Option:  ignoreregex
242
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
242
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
243
# Values:  TEXT
243
# Values:  TEXT
244
#
244
#
245
ignoreregex = 
245
ignoreregex = 
246
EOF
246
EOF
247
 
247
 
248
#####################
248
#####################
249
## CHANGE-PWD.CONF ##
249
## CHANGE-PWD.CONF ##
250
#####################
250
#####################
251
cat << EOF > $DIR_FILTER/alcasar_change-pwd.conf
251
cat << EOF > $DIR_FILTER/alcasar_change-pwd.conf
252
 
252
 
253
# Fail2Ban configuration file
253
# Fail2Ban configuration file
254
#
254
#
255
# Author: Cyril Jaquier
255
# Author: Cyril Jaquier
256
# Adapted by ALCASAR team
256
# Adapted by ALCASAR team
257
 
257
 
258
[Definition]
258
[Definition]
259
 
259
 
260
# Option:  failregex
260
# Option:  failregex
261
# Notes.:  regex to match the password failure messages in the logfile. The
261
# Notes.:  regex to match the password failure messages in the logfile. The
262
#          host must be matched by a group named "host". The tag "<HOST>" can
262
#          host must be matched by a group named "host". The tag "<HOST>" can
263
#          be used for standard IP/hostname matching and is only an alias for
263
#          be used for standard IP/hostname matching and is only an alias for
264
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
264
#          (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
265
# Values:  TEXT
265
# Values:  TEXT
266
#
266
#
267
failregex = \[<HOST>\] \"POST \/password\.php
267
failregex = \[<HOST>\] \"POST \/password\.php
268
 
268
 
269
 
269
 
270
# Option:  ignoreregex
270
# Option:  ignoreregex
271
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
271
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
272
# Values:  TEXT
272
# Values:  TEXT
273
#
273
#
274
ignoreregex = 
274
ignoreregex = 
275
EOF
275
EOF
276
 
276
 
277
##############################################
277
##############################################
278
##   Log sur ULOG quand iptables-allports   ##
278
##   Log sur ULOG quand iptables-allports   ##
279
##############################################
279
##############################################
280
[ -f $ACTION_ALLPORTS ] && [ ! -e $ACTION_ALLPORTS.default ] && mv $ACTION_ALLPORTS $ACTION_ALLPORTS.default
280
[ -f $ACTION_ALLPORTS ] && [ ! -e $ACTION_ALLPORTS.default ] && mv $ACTION_ALLPORTS $ACTION_ALLPORTS.default
281
cat << EOF > $ACTION_ALLPORTS
281
cat << EOF > $ACTION_ALLPORTS
282
# Fail2Ban configuration file
282
# Fail2Ban configuration file
283
#
283
#
284
# Author: Cyril Jaquier
284
# Author: Cyril Jaquier
285
# Modified: Yaroslav O. Halchenko <debian@onerussian.com>
285
# Modified: Yaroslav O. Halchenko <debian@onerussian.com>
286
# 			made active on all ports from original iptables.conf
286
# 			made active on all ports from original iptables.conf
287
# Adapted by ALCASAR team
287
# Adapted by ALCASAR team
288
 
288
 
289
[Definition]
289
[Definition]
290
 
290
 
291
# Option:  actionstart
291
# Option:  actionstart
292
# Notes.:  command executed once at the start of Fail2Ban.
292
# Notes.:  command executed once at the start of Fail2Ban.
293
# Values:  CMD
293
# Values:  CMD
294
#
294
#
295
actionstart = iptables -N fail2ban-<name>
295
actionstart = iptables -N fail2ban-<name>
296
              iptables -A fail2ban-<name> -j RETURN
296
              iptables -A fail2ban-<name> -j RETURN
297
              iptables -I <chain> -p <protocol> -j fail2ban-<name>
297
              iptables -I <chain> -p <protocol> -j fail2ban-<name>
298
 
298
 
299
# Option:  actionstop
299
# Option:  actionstop
300
# Notes.:  command executed once at the end of Fail2Ban
300
# Notes.:  command executed once at the end of Fail2Ban
301
# Values:  CMD
301
# Values:  CMD
302
#
302
#
303
actionstop = iptables -D <chain> -p <protocol> -j fail2ban-<name>
303
actionstop = iptables -D <chain> -p <protocol> -j fail2ban-<name>
304
             iptables -F fail2ban-<name>
304
             iptables -F fail2ban-<name>
305
             iptables -X fail2ban-<name>
305
             iptables -X fail2ban-<name>
306
 
306
 
307
# Option:  actioncheck
307
# Option:  actioncheck
308
# Notes.:  command executed once before each actionban command
308
# Notes.:  command executed once before each actionban command
309
# Values:  CMD
309
# Values:  CMD
310
#
310
#
311
actioncheck = iptables -n -L <chain> | grep -q fail2ban-<name>
311
actioncheck = iptables -n -L <chain> | grep -q fail2ban-<name>
312
 
312
 
313
# Option:  actionban
313
# Option:  actionban
314
# Notes.:  command executed when banning an IP. Take care that the
314
# Notes.:  command executed when banning an IP. Take care that the
315
#          command is executed with Fail2Ban user rights.
315
#          command is executed with Fail2Ban user rights.
316
# Tags:    <ip>  IP address
316
# Tags:    <ip>  IP address
317
#          <failures>  number of failures
317
#          <failures>  number of failures
318
#          <time>  unix timestamp of the ban time
318
#          <time>  unix timestamp of the ban time
319
# Values:  CMD
319
# Values:  CMD
320
 
320
 
321
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j NFLOG --nflog-group 1 --nflog-prefix "RULE Fail2Ban -- DROP"
-
 
322
            iptables -I fail2ban-<name> 1 -s <ip> -j DROP
321
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j DROP
323
 
322
 
324
# Option:  actionunban
323
# Option:  actionunban
325
# Notes.:  command executed when unbanning an IP. Take care that the
324
# Notes.:  command executed when unbanning an IP. Take care that the
326
#          command is executed with Fail2Ban user rights.
325
#          command is executed with Fail2Ban user rights.
327
# Tags:    <ip>  IP address
326
# Tags:    <ip>  IP address
328
#          <failures>  number of failures
327
#          <failures>  number of failures
329
#          <time>  unix timestamp of the ban time
328
#          <time>  unix timestamp of the ban time
330
# Values:  CMD
329
# Values:  CMD
331
#
330
#
332
actionunban = iptables -D fail2ban-<name> -s <ip> -j NFLOG --nflog-group 1 --nflog-prefix "RULE Fail2Ban -- DROP"
-
 
333
              iptables -D fail2ban-<name> -s <ip> -j DROP
331
actionunban = iptables -D fail2ban-<name> -s <ip> -j DROP
334
 
332
 
335
[Init]
333
[Init]
336
 
334
 
337
# Defaut name of the chain
335
# Defaut name of the chain
338
#
336
#
339
name = default
337
name = default
340
 
338
 
341
# Option:  protocol
339
# Option:  protocol
342
# Notes.:  internally used by config reader for interpolations.
340
# Notes.:  internally used by config reader for interpolations.
343
# Values:  [ tcp | udp | icmp | all ] Default: tcp
341
# Values:  [ tcp | udp | icmp | all ] Default: tcp
344
#
342
#
345
protocol = tcp
343
protocol = tcp
346
 
344
 
347
# Option:  chain
345
# Option:  chain
348
# Notes    specifies the iptables chain to which the fail2ban rules should be
346
# Notes    specifies the iptables chain to which the fail2ban rules should be
349
#          added
347
#          added
350
# Values:  STRING  Default: INPUT
348
# Values:  STRING  Default: INPUT
351
chain = INPUT
349
chain = INPUT
352
 
350
 
353
EOF
351
EOF
354
 
352