1FAIL2BAN-CLIENT(1) User Commands FAIL2BAN-CLIENT(1)
2
3
4
6 fail2ban-client - configure and control the server
7
9 fail2ban-client [OPTIONS] <COMMAND>
10
12 Fail2Ban v0.10.4 reads log file that contains password failure report
13 and bans the corresponding IP addresses using firewall rules.
14
16 -c <DIR>
17 configuration directory
18
19 -s <FILE>
20 socket path
21
22 -p <FILE>
23 pidfile path
24
25 --loglevel <LEVEL>
26 logging level
27
28 --logtarget <TARGET>
29 logging target, use file-name or stdout, stderr, syslog or
30 sysout.
31
32 --syslogsocket auto|<FILE>
33
34 -d dump configuration. For debugging
35
36 --dp, --dump-pretty
37 dump the configuration using more human readable representation
38
39 -t, --test
40 test configuration (can be also specified with start parameters)
41
42 -i interactive mode
43
44 -v increase verbosity
45
46 -q decrease verbosity
47
48 -x force execution of the server (remove socket file)
49
50 -b start server in background (default)
51
52 -f start server in foreground
53
54 --async
55 start server in async mode (for internal usage only, don't read
56 configuration)
57
58 --timeout
59 timeout to wait for the server (for internal usage only, don't
60 read configuration)
61
62 --str2sec <STRING>
63 convert time abbreviation format to seconds
64
65 -h, --help
66 display this help message
67
68 -V, --version
69 print the version (-V returns machine-readable short format)
70
72 BASIC
73
74 start starts the server and the jails
75
76 restart
77 restarts the server
78
79 restart [--unban] [--if-exists] <JAIL>
80 restarts the jail <JAIL> (alias for 'reload --restart ...
81 <JAIL>')
82
83 reload [--restart] [--unban] [--all]
84 reloads the configuration without restarting of the server, the
85 option '--restart' activates completely restarting of affected
86 jails, thereby can unban IP addresses (if option '--unban' spec‐
87 ified)
88
89 reload [--restart] [--unban] [--if-exists] <JAIL>
90 reloads the jail <JAIL>, or restarts it (if option '--restart'
91 specified)
92
93 stop stops all jails and terminate the server
94
95 unban --all
96 unbans all IP addresses (in all jails and database)
97
98 unban <IP> ... <IP>
99 unbans <IP> (in all jails and database)
100
101 status gets the current status of the server
102
103 ping tests if the server is alive
104
105 echo for internal usage, returns back and outputs a given string
106
107 help return this output
108
109 version
110 return the server version
111
112 LOGGING
113
114 set loglevel <LEVEL>
115 sets logging level to <LEVEL>. Levels: CRITICAL, ERROR, WARN‐
116 ING, NOTICE, INFO, DEBUG, TRACEDEBUG, HEAVYDEBUG or correspond‐
117 ing numeric value (50-5)
118
119 get loglevel
120 gets the logging level
121
122 set logtarget <TARGET>
123 sets logging target to <TARGET>. Can be STDOUT, STDERR, SYSLOG
124 or a file
125
126 get logtarget
127 gets logging target
128
129 set syslogsocket auto|<SOCKET>
130 sets the syslog socket path to auto or <SOCKET>. Only used if
131 logtarget is SYSLOG
132
133 get syslogsocket
134 gets syslog socket path
135
136 flushlogs
137 flushes the logtarget if a file and reopens it. For log rota‐
138 tion.
139
140 DATABASE
141
142 set dbfile <FILE>
143 set the location of fail2ban persistent datastore. Set to "None"
144 to disable
145
146 get dbfile
147 get the location of fail2ban persistent datastore
148
149 set dbpurgeage <SECONDS>
150 sets the max age in <SECONDS> that history of bans will be kept
151
152 get dbpurgeage
153 gets the max age in seconds that history of bans will be kept
154
155 JAIL CONTROL
156
157 add <JAIL> <BACKEND>
158 creates <JAIL> using <BACKEND>
159
160 start <JAIL>
161 starts the jail <JAIL>
162
163 stop <JAIL>
164 stops the jail <JAIL>. The jail is removed
165
166 status <JAIL> [FLAVOR]
167 gets the current status of <JAIL>, with optional flavor or
168 extended info
169
170 JAIL CONFIGURATION
171
172 set <JAIL> idle on|off
173 sets the idle state of <JAIL>
174
175 set <JAIL> ignoreself true|false
176 allows the ignoring of own IP addresses
177
178 set <JAIL> addignoreip <IP>
179 adds <IP> to the ignore list of <JAIL>
180
181 set <JAIL> delignoreip <IP>
182 removes <IP> from the ignore list of <JAIL>
183
184 set <JAIL> ignorecommand <VALUE>
185 sets ignorecommand of <JAIL>
186
187 set <JAIL> ignorecache <VALUE>
188 sets ignorecache of <JAIL>
189
190 set <JAIL> addlogpath <FILE> ['tail']
191 adds <FILE> to the monitoring list of <JAIL>, optionally start‐
192 ing at the 'tail' of the file (default 'head').
193
194 set <JAIL> dellogpath <FILE>
195 removes <FILE> from the monitoring list of <JAIL>
196
197 set <JAIL> logencoding <ENCODING>
198 sets the <ENCODING> of the log files for <JAIL>
199
200 set <JAIL> addjournalmatch <MATCH>
201 adds <MATCH> to the journal filter of <JAIL>
202
203 set <JAIL> deljournalmatch <MATCH>
204 removes <MATCH> from the journal filter of <JAIL>
205
206 set <JAIL> addfailregex <REGEX>
207 adds the regular expression <REGEX> which must match failures
208 for <JAIL>
209
210 set <JAIL> delfailregex <INDEX>
211 removes the regular expression at <INDEX> for failregex
212
213 set <JAIL> addignoreregex <REGEX>
214 adds the regular expression <REGEX> which should match pattern
215 to exclude for <JAIL>
216
217 set <JAIL> delignoreregex <INDEX>
218 removes the regular expression at <INDEX> for ignoreregex
219
220 set <JAIL> findtime <TIME>
221 sets the number of seconds <TIME> for which the filter will look
222 back for <JAIL>
223
224 set <JAIL> bantime <TIME>
225 sets the number of seconds <TIME> a host will be banned for
226 <JAIL>
227
228 set <JAIL> datepattern <PATTERN>
229 sets the <PATTERN> used to match date/times for <JAIL>
230
231 set <JAIL> usedns <VALUE>
232 sets the usedns mode for <JAIL>
233
234 set <JAIL> banip <IP>
235 manually Ban <IP> for <JAIL>
236
237 set <JAIL> unbanip <IP>
238 manually Unban <IP> in <JAIL>
239
240 set <JAIL> maxretry <RETRY>
241 sets the number of failures <RETRY> before banning the host for
242 <JAIL>
243
244 set <JAIL> maxlines <LINES>
245 sets the number of <LINES> to buffer for regex search for <JAIL>
246
247 set <JAIL> addaction <ACT>[ <PYTHONFILE> <JSONKWARGS>]
248 adds a new action named <ACT> for <JAIL>. Optionally for a
249 Python based action, a <PYTHONFILE> and <JSONKWARGS> can be
250 specified, else will be a Command Action
251
252 set <JAIL> delaction <ACT>
253 removes the action <ACT> from <JAIL>
254
255 COMMAND ACTION CONFIGURATION
256
257 set <JAIL> action <ACT> actionstart <CMD>
258 sets the start command <CMD> of the action <ACT> for <JAIL>
259
260 set <JAIL> action <ACT> actionstop <CMD> sets the stop command <CMD> of
261 the
262 action <ACT> for <JAIL>
263
264 set <JAIL> action <ACT> actioncheck <CMD>
265 sets the check command <CMD> of the action <ACT> for <JAIL>
266
267 set <JAIL> action <ACT> actionban <CMD>
268 sets the ban command <CMD> of the action <ACT> for <JAIL>
269
270 set <JAIL> action <ACT> actionunban <CMD>
271 sets the unban command <CMD> of the action <ACT> for <JAIL>
272
273 set <JAIL> action <ACT> timeout <TIMEOUT>
274 sets <TIMEOUT> as the command timeout in seconds for the action
275 <ACT> for <JAIL>
276
277 GENERAL ACTION CONFIGURATION
278
279 set <JAIL> action <ACT> <PROPERTY> <VALUE>
280 sets the <VALUE> of <PROPERTY> for the action <ACT> for <JAIL>
281
282 set <JAIL> action <ACT> <METHOD>[ <JSONKWARGS>]
283 calls the <METHOD> with <JSONKWARGS> for the action <ACT> for
284 <JAIL>
285
286 JAIL INFORMATION
287
288 get <JAIL> logpath
289 gets the list of the monitored files for <JAIL>
290
291 get <JAIL> logencoding
292 gets the encoding of the log files for <JAIL>
293
294 get <JAIL> journalmatch
295 gets the journal filter match for <JAIL>
296
297 get <JAIL> ignoreself
298 gets the current value of the ignoring the own IP addresses
299
300 get <JAIL> ignoreip
301 gets the list of ignored IP addresses for <JAIL>
302
303 get <JAIL> ignorecommand
304 gets ignorecommand of <JAIL>
305
306 get <JAIL> failregex
307 gets the list of regular expressions which matches the failures
308 for <JAIL>
309
310 get <JAIL> ignoreregex
311 gets the list of regular expressions which matches patterns to
312 ignore for <JAIL>
313
314 get <JAIL> findtime
315 gets the time for which the filter will look back for failures
316 for <JAIL>
317
318 get <JAIL> bantime
319 gets the time a host is banned for <JAIL>
320
321 get <JAIL> datepattern
322 gets the patern used to match date/times for <JAIL>
323
324 get <JAIL> usedns
325 gets the usedns setting for <JAIL>
326
327 get <JAIL> maxretry
328 gets the number of failures allowed for <JAIL>
329
330 get <JAIL> maxlines
331 gets the number of lines to buffer for <JAIL>
332
333 get <JAIL> actions
334 gets a list of actions for <JAIL>
335
336 COMMAND ACTION INFORMATION
337
338 get <JAIL> action <ACT> actionstart
339 gets the start command for the action <ACT> for <JAIL>
340
341 get <JAIL> action <ACT> actionstop
342 gets the stop command for the action <ACT> for <JAIL>
343
344 get <JAIL> action <ACT> actioncheck
345 gets the check command for the action <ACT> for <JAIL>
346
347 get <JAIL> action <ACT> actionban
348 gets the ban command for the action <ACT> for <JAIL>
349
350 get <JAIL> action <ACT> actionunban
351 gets the unban command for the action <ACT> for <JAIL>
352
353 get <JAIL> action <ACT> timeout
354 gets the command timeout in seconds for the action <ACT> for
355 <JAIL>
356
357 GENERAL ACTION INFORMATION
358
359 get <JAIL> actionproperties <ACT>
360 gets a list of properties for the action <ACT> for <JAIL>
361
362 get <JAIL> actionmethods <ACT>
363 gets a list of methods for the action <ACT> for <JAIL>
364
365 get <JAIL> action <ACT> <PROPERTY>
366 gets the value of <PROPERTY> for the action <ACT> for <JAIL>
367
369 /etc/fail2ban/*
370
372 Report bugs to https://github.com/fail2ban/fail2ban/issues
373
375 fail2ban-server(1) jail.conf(5)
376
377
378
379fail2ban-client v0.10.4 October 2018 FAIL2BAN-CLIENT(1)