summaryrefslogtreecommitdiff
path: root/man/fail2ban-client.1
blob: 9fa0b8033da4c69753c5a09ebfbd112c4cccbb9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.1.
.TH FAIL2BAN-CLIENT "1" "November 2022" "Fail2Ban v1.0.3.dev1" "User Commands"
.SH NAME
fail2ban-client \- configure and control the server
.SH SYNOPSIS
.B fail2ban-client
[\fI\,OPTIONS\/\fR] \fI\,<COMMAND>\/\fR
.SH DESCRIPTION
Fail2Ban v1.0.3.dev1 reads log file that contains password failure report
and bans the corresponding IP addresses using firewall rules.
.SH OPTIONS
.TP
\fB\-c\fR, \fB\-\-conf\fR <DIR>
configuration directory
.TP
\fB\-s\fR, \fB\-\-socket\fR <FILE>
socket path
.TP
\fB\-p\fR, \fB\-\-pidfile\fR <FILE>
pidfile path
.TP
\fB\-\-pname\fR <NAME>
name of the process (main thread) to identify instance (default fail2ban\-server)
.TP
\fB\-\-loglevel\fR <LEVEL>
logging level
.TP
\fB\-\-logtarget\fR <TARGET>
logging target, use file\-name or stdout, stderr, syslog or sysout.
.HP
\fB\-\-syslogsocket\fR auto|<FILE>
.TP
\fB\-d\fR
dump configuration. For debugging
.TP
\fB\-\-dp\fR, \fB\-\-dump\-pretty\fR
dump the configuration using more human readable representation
.TP
\fB\-t\fR, \fB\-\-test\fR
test configuration (can be also specified with start parameters)
.TP
\fB\-i\fR
interactive mode
.TP
\fB\-v\fR
increase verbosity
.TP
\fB\-q\fR
decrease verbosity
.TP
\fB\-x\fR
force execution of the server (remove socket file)
.TP
\fB\-b\fR
start server in background (default)
.TP
\fB\-f\fR
start server in foreground
.TP
\fB\-\-async\fR
start server in async mode (for internal usage only, don't read configuration)
.TP
\fB\-\-timeout\fR
timeout to wait for the server (for internal usage only, don't read configuration)
.TP
\fB\-\-str2sec\fR <STRING>
convert time abbreviation format to seconds
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help message
.TP
\fB\-V\fR, \fB\-\-version\fR
print the version (\fB\-V\fR returns machine\-readable short format)
.SH COMMAND
.IP
BASIC
.TP
\fBstart\fR
starts the server and the jails
.TP
\fBrestart\fR
restarts the server
.TP
\fBrestart [\-\-unban] [\-\-if\-exists] <JAIL>\fR
restarts the jail <JAIL> (alias
for 'reload \fB\-\-restart\fR ... <JAIL>')
.TP
\fBreload [\-\-restart] [\-\-unban] [\-\-all]\fR
reloads the configuration without
restarting of the server, the
option '\-\-restart' activates
completely restarting of affected
jails, thereby can unban IP
addresses (if option '\-\-unban'
specified)
.TP
\fBreload [\-\-restart] [\-\-unban] [\-\-if\-exists] <JAIL>\fR
reloads the jail <JAIL>, or
restarts it (if option '\-\-restart'
specified)
.TP
\fBstop\fR
stops all jails and terminate the
server
.TP
\fBunban \fB\-\-all\fR\fR
unbans all IP addresses (in all
jails and database)
.TP
\fBunban <IP> ... <IP>\fR
unbans <IP> (in all jails and
database)
.TP
\fBbanned\fR
return jails with banned IPs as
dictionary
.TP
\fBbanned <IP> ... <IP>]\fR
return list(s) of jails where
given IP(s) are banned
.TP
\fBstatus\fR
gets the current status of the
server
.TP
\fBping\fR
tests if the server is alive
.TP
\fBecho\fR
for internal usage, returns back
and outputs a given string
.TP
\fBhelp\fR
return this output
.TP
\fBversion\fR
return the server version
.IP
LOGGING
.TP
\fBset loglevel <LEVEL>\fR
sets logging level to <LEVEL>.
Levels: CRITICAL, ERROR, WARNING,
NOTICE, INFO, DEBUG, TRACEDEBUG,
HEAVYDEBUG or corresponding
numeric value (50\-5)
.TP
\fBget loglevel\fR
gets the logging level
.TP
\fBset logtarget <TARGET>\fR
sets logging target to <TARGET>.
Can be STDOUT, STDERR, SYSLOG,
SYSTEMD\-JOURNAL or a file
.TP
\fBget logtarget\fR
gets logging target
.TP
\fBset syslogsocket auto|<SOCKET>\fR
sets the syslog socket path to
auto or <SOCKET>. Only used if
logtarget is SYSLOG
.TP
\fBget syslogsocket\fR
gets syslog socket path
.TP
\fBflushlogs\fR
flushes the logtarget if a file
and reopens it. For log rotation.
.IP
DATABASE
.TP
\fBset dbfile <FILE>\fR
set the location of fail2ban
persistent datastore. Set to
"None" to disable
.TP
\fBget dbfile\fR
get the location of fail2ban
persistent datastore
.TP
\fBset dbmaxmatches <INT>\fR
sets the max number of matches
stored in database per ticket
.TP
\fBget dbmaxmatches\fR
gets the max number of matches
stored in database per ticket
.TP
\fBset dbpurgeage <SECONDS>\fR
sets the max age in <SECONDS> that
history of bans will be kept
.TP
\fBget dbpurgeage\fR
gets the max age in seconds that
history of bans will be kept
.IP
JAIL CONTROL
.TP
\fBadd <JAIL> <BACKEND>\fR
creates <JAIL> using <BACKEND>
.TP
\fBstart <JAIL>\fR
starts the jail <JAIL>
.TP
\fBstop <JAIL>\fR
stops the jail <JAIL>. The jail is
removed
.TP
\fBstatus <JAIL> [FLAVOR]\fR
gets the current status of <JAIL>,
with optional flavor or extended
info
.IP
JAIL CONFIGURATION
.TP
\fBset <JAIL> idle on|off\fR
sets the idle state of <JAIL>
.TP
\fBset <JAIL> ignoreself true|false\fR
allows the ignoring of own IP
addresses
.TP
\fBset <JAIL> addignoreip <IP>\fR
adds <IP> to the ignore list of
<JAIL>
.TP
\fBset <JAIL> delignoreip <IP>\fR
removes <IP> from the ignore list
of <JAIL>
.TP
\fBset <JAIL> ignorecommand <VALUE>\fR
sets ignorecommand of <JAIL>
.TP
\fBset <JAIL> ignorecache <VALUE>\fR
sets ignorecache of <JAIL>
.TP
\fBset <JAIL> addlogpath <FILE> ['tail']\fR
adds <FILE> to the monitoring list
of <JAIL>, optionally starting at
the 'tail' of the file (default
\&'head').
.TP
\fBset <JAIL> dellogpath <FILE>\fR
removes <FILE> from the monitoring
list of <JAIL>
.TP
\fBset <JAIL> logencoding <ENCODING>\fR
sets the <ENCODING> of the log
files for <JAIL>
.TP
\fBset <JAIL> addjournalmatch <MATCH>\fR
adds <MATCH> to the journal filter
of <JAIL>
.TP
\fBset <JAIL> deljournalmatch <MATCH>\fR
removes <MATCH> from the journal
filter of <JAIL>
.TP
\fBset <JAIL> addfailregex <REGEX>\fR
adds the regular expression
<REGEX> which must match failures
for <JAIL>
.TP
\fBset <JAIL> delfailregex <INDEX>\fR
removes the regular expression at
<INDEX> for failregex
.TP
\fBset <JAIL> addignoreregex <REGEX>\fR
adds the regular expression
<REGEX> which should match pattern
to exclude for <JAIL>
.TP
\fBset <JAIL> delignoreregex <INDEX>\fR
removes the regular expression at
<INDEX> for ignoreregex
.TP
\fBset <JAIL> findtime <TIME>\fR
sets the number of seconds <TIME>
for which the filter will look
back for <JAIL>
.TP
\fBset <JAIL> bantime <TIME>\fR
sets the number of seconds <TIME>
a host will be banned for <JAIL>
.TP
\fBset <JAIL> datepattern <PATTERN>\fR
sets the <PATTERN> used to match
date/times for <JAIL>
.TP
\fBset <JAIL> usedns <VALUE>\fR
sets the usedns mode for <JAIL>
.TP
\fBset <JAIL> attempt <IP> [<failure1> ... <failureN>]\fR
manually notify about <IP> failure
.TP
\fBset <JAIL> banip <IP> ... <IP>\fR
manually Ban <IP> for <JAIL>
.TP
\fBset <JAIL> unbanip [\-\-report\-absent] <IP> ... <IP>\fR
manually Unban <IP> in <JAIL>
.TP
\fBset <JAIL> maxretry <RETRY>\fR
sets the number of failures
<RETRY> before banning the host
for <JAIL>
.TP
\fBset <JAIL> maxmatches <INT>\fR
sets the max number of matches
stored in memory per ticket in
<JAIL>
.TP
\fBset <JAIL> maxlines <LINES>\fR
sets the number of <LINES> to
buffer for regex search for <JAIL>
.TP
\fBset <JAIL> addaction <ACT>[ <PYTHONFILE> <JSONKWARGS>]\fR
adds a new action named <ACT> for
<JAIL>. Optionally for a Python
based action, a <PYTHONFILE> and
<JSONKWARGS> can be specified,
else will be a Command Action
.TP
\fBset <JAIL> delaction <ACT>\fR
removes the action <ACT> from
<JAIL>
.IP
COMMAND ACTION CONFIGURATION
.TP
\fBset <JAIL> action <ACT> actionstart <CMD>\fR
sets the start command <CMD> of
the action <ACT> for <JAIL>
.TP
\fBset <JAIL> action <ACT> actionstop <CMD> sets the stop command <CMD> of the\fR
action <ACT> for <JAIL>
.TP
\fBset <JAIL> action <ACT> actioncheck <CMD>\fR
sets the check command <CMD> of
the action <ACT> for <JAIL>
.TP
\fBset <JAIL> action <ACT> actionban <CMD>\fR
sets the ban command <CMD> of the
action <ACT> for <JAIL>
.TP
\fBset <JAIL> action <ACT> actionunban <CMD>\fR
sets the unban command <CMD> of
the action <ACT> for <JAIL>
.TP
\fBset <JAIL> action <ACT> timeout <TIMEOUT>\fR
sets <TIMEOUT> as the command
timeout in seconds for the action
<ACT> for <JAIL>
.IP
GENERAL ACTION CONFIGURATION
.TP
\fBset <JAIL> action <ACT> <PROPERTY> <VALUE>\fR
sets the <VALUE> of <PROPERTY> for
the action <ACT> for <JAIL>
.TP
\fBset <JAIL> action <ACT> <METHOD>[ <JSONKWARGS>]\fR
calls the <METHOD> with
<JSONKWARGS> for the action <ACT>
for <JAIL>
.IP
JAIL INFORMATION
.TP
\fBget <JAIL> banned\fR
return banned IPs of <JAIL>
.TP
\fBget <JAIL> banned <IP> ... <IP>]\fR
return 1 if IP is banned in <JAIL>
otherwise 0, or a list of 1/0 for
multiple IPs
.TP
\fBget <JAIL> logpath\fR
gets the list of the monitored
files for <JAIL>
.TP
\fBget <JAIL> logencoding\fR
gets the encoding of the log files
for <JAIL>
.TP
\fBget <JAIL> journalmatch\fR
gets the journal filter match for
<JAIL>
.TP
\fBget <JAIL> ignoreself\fR
gets the current value of the
ignoring the own IP addresses
.TP
\fBget <JAIL> ignoreip\fR
gets the list of ignored IP
addresses for <JAIL>
.TP
\fBget <JAIL> ignorecommand\fR
gets ignorecommand of <JAIL>
.TP
\fBget <JAIL> failregex\fR
gets the list of regular
expressions which matches the
failures for <JAIL>
.TP
\fBget <JAIL> ignoreregex\fR
gets the list of regular
expressions which matches patterns
to ignore for <JAIL>
.TP
\fBget <JAIL> findtime\fR
gets the time for which the filter
will look back for failures for
<JAIL>
.TP
\fBget <JAIL> bantime\fR
gets the time a host is banned for
<JAIL>
.TP
\fBget <JAIL> datepattern\fR
gets the pattern used to match
date/times for <JAIL>
.TP
\fBget <JAIL> usedns\fR
gets the usedns setting for <JAIL>
.TP
\fBget <JAIL> banip [<SEP>|\-\-with\-time]\fR
gets the list of of banned IP
addresses for <JAIL>. Optionally
the separator character ('<SEP>',
default is space) or the option
\&'\-\-with\-time' (printing the times
of ban) may be specified. The IPs
are ordered by end of ban.
.TP
\fBget <JAIL> maxretry\fR
gets the number of failures
allowed for <JAIL>
.TP
\fBget <JAIL> maxmatches\fR
gets the max number of matches
stored in memory per ticket in
<JAIL>
.TP
\fBget <JAIL> maxlines\fR
gets the number of lines to buffer
for <JAIL>
.TP
\fBget <JAIL> actions\fR
gets a list of actions for <JAIL>
.IP
COMMAND ACTION INFORMATION
.TP
\fBget <JAIL> action <ACT> actionstart\fR
gets the start command for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> action <ACT> actionstop\fR
gets the stop command for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> action <ACT> actioncheck\fR
gets the check command for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> action <ACT> actionban\fR
gets the ban command for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> action <ACT> actionunban\fR
gets the unban command for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> action <ACT> timeout\fR
gets the command timeout in
seconds for the action <ACT> for
<JAIL>
.IP
GENERAL ACTION INFORMATION
.TP
\fBget <JAIL> actionproperties <ACT>\fR
gets a list of properties for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> actionmethods <ACT>\fR
gets a list of methods for the
action <ACT> for <JAIL>
.TP
\fBget <JAIL> action <ACT> <PROPERTY>\fR
gets the value of <PROPERTY> for
the action <ACT> for <JAIL>
.SH FILES
\fI/etc/fail2ban/*\fR
.SH "REPORTING BUGS"
Report bugs to https://github.com/fail2ban/fail2ban/issues
.SH "SEE ALSO"
.br 
fail2ban-server(1)
jail.conf(5)