mirror of https://github.com/fail2ban/fail2ban
Additional FAQ added regarding troubleshooting and diagnosing startup errors
Changes to FAQ on Tracing Errors and Debuggingmaster
parent
916cdbfc33
commit
873bc1b982
|
@ -72,4 +72,63 @@ You can also get and set corresponding parameter individually, using fail2ban cl
|
|||
```bash
|
||||
fail2ban-client set pam-generic logencoding UTF-8
|
||||
fail2ban-client set nginx findtime 10m
|
||||
```
|
||||
```
|
||||
|
||||
**[Q]** How should I correctly modify log file locations other than in the jail settings or messing with master .conf files?<br/>
|
||||
**[A]** To make a modification to the default log file locations you should create a .local file of paths-common.conf or paths-debian.com (whichever you are using in jail.local) and make changes only in your .local files which keeps it nicely structured for your jail(s) settings and avoids problems when Fail2Ban is updated<br/><br/>
|
||||
|
||||
To create your .local file<br/>
|
||||
`sudo cp /etc/fail2ban/paths-common.conf /etc/fail2ban/paths-common.local`<br/><br/>
|
||||
|
||||
Now if you want for example an Nginx filter to read all your Nginx Access Logs for multiple web sites<br/>
|
||||
|
||||
Instead of using in your jail:<br/>
|
||||
`logpath = /var/log/nginx/*access*.log`<br/><br/>
|
||||
|
||||
Edit the line in paths-common.local or paths-debian.local (whichever you are using) and add change the nginx_access_log line as follows<br/>
|
||||
`nginx_access_log = /var/log/nginx/*access*.log`<br/><br/>
|
||||
|
||||
Then in your jail you would rather use<br/>
|
||||
`logpath = %(nginx_access_log)s`<br/><br/>
|
||||
|
||||
|
||||
**[Q]** I messed up Fail2Ban during Testing and blocked out my own IP address, how do I completely reset Fail2Ban to get it off to a clean start?<br/>
|
||||
**[A]** To reset fail2ban completely and start off fresh<br/><br/>
|
||||
In newer versions of Fail2Ban you can simply run the command<br/>
|
||||
`sudo fail2ban-client set <JAIL> unbanip <IP>`<br/>
|
||||
Which will remove all entries for that IP in both the fail2ban.log file and fail2ban.sqlite3 database file.<br/><br/>
|
||||
|
||||
Should you ever want to completely clear and reset the Fail2Ban log file and SQLite database for whatever reason you can do the following:<br/><br/>
|
||||
Stop Fail2Ban<br/>
|
||||
`sudo service fail2ban stop`<br/><br/>
|
||||
Empty the Fail2Ban LogFile<br/>
|
||||
`sudo truncate -s 0 /var/log/fail2ban.log`<br/><br/>
|
||||
Delete the Fail2Ban SQLite Database File<br/>
|
||||
`sudo rm /var/lib/fail2ban/fail2ban.sqlite3`<br/><br/>
|
||||
Restart Fail2Ban<br/>
|
||||
`sudo service fail2ban restart`<br/><br/>
|
||||
Also consider deleting any of your Apache, Nginx or Auth log files or just the entries that may contain your own IP address used during testing, as once Fail2Ban starts again, depending on your jail settings, it will just block you again.<br/><br/>
|
||||
|
||||
**[Q]** Fail2Ban will not start and is giving me the following error message "Job for fail2ban.service failed. See 'systemctl status fail2ban.service' and 'journalctl -xn' for details." but checking those does not help me trace where my error is.<br/>
|
||||
**[A]** <br/>
|
||||
First take a look in journal log of fail2ban.service by running<br/>
|
||||
`journalctl -ru fail2ban`<br/><br/>
|
||||
If you find and fix your error then reload fail2ban using<br/>
|
||||
`sudo service fail2ban restart`<br/><br/>
|
||||
|
||||
Your fail2ban.log file in /var/log/fail2ban.log is also a very good place to keep a check for errors.<br/><br/>
|
||||
|
||||
**For Heavy Debugging Users**<br/>
|
||||
You can run the Fail2Ban-Client in a very verbose mode using the following commands which will show you all output when Fail2Ban is loading, this is also a useful method for tracing errors in jails, filters and actions.<br/><br/>
|
||||
Stop the Failban Server by running<br/>
|
||||
`sudo service fail2ban stop`<br/><br/>
|
||||
Make sure the Fail2Ban client is also not running by running the following<br/>
|
||||
`sudo fail2ban-client -vvv -x stop`<br/><br/>
|
||||
Then start the Fail2Ban client in verbose mode as follows<br/>
|
||||
`sudo fail2ban-client -vvv -x start`<br/><br/>
|
||||
This will show you exactly in which jail, filter or action your error lies.
|
||||
Once you can start the fail2ban-client successfully using `sudo fail2ban-client -vvv -x start`<br/><br/>
|
||||
Then stop it again using <br/>
|
||||
`sudo fail2ban-client -vvv -x stop`<br/><br/>
|
||||
and then start the Fail2Ban Server<br/>
|
||||
`sudo service fail2ban restart`<br/><br/>
|
Loading…
Reference in New Issue