Fail2Ban Not starting when using sudo systemctl status fail2ban.service
sorry i would like to give it as a comment not answer but i don't have much reputation, so i suggest you have enabled a jail for a non-existed service on your jail.local file, so go to that /etc/fail2ban/jail.local and search for what you've enabled and delete the enabled word and sentence then "sudo systemctl restart fail2ban" and check "sudo systemctl status fail2ban"
and vola it works! or that what i hope, tell me if it worked, i might help you further
Related videos on Youtube
Leon W
Updated on September 18, 2022Comments
-
Leon W almost 2 years
When i try and restart fail2ban using
sudo service fail2ban restart
it displays the following error fromsystemctl status fail2ban.service
Apr 02 20:12:30 centos systemd[1]: fail2ban.service: control process exited, code=exited status=255 Apr 02 20:12:30 centos systemd[1]: Failed to start Fail2Ban Service. Apr 02 20:12:30 centos systemd[1]: Unit fail2ban.service entered failed state. Apr 02 20:12:30 centos systemd[1]: fail2ban.service failed. Apr 02 20:12:30 centos systemd[1]: fail2ban.service holdoff time over, scheduling restart. Apr 02 20:12:30 centos systemd[1]: Stopped Fail2Ban Service. Apr 02 20:12:30 centos systemd[1]: start request repeated too quickly for fail2ban.service Apr 02 20:12:30 centos systemd[1]: Failed to start Fail2Ban Service. Apr 02 20:12:30 centos systemd[1]: Unit fail2ban.service entered failed state. Apr 02 20:12:30 centos systemd[1]: fail2ban.service failed.
then when i run it, displays this error sugesting that fail2ban is not starting as sudo
Apr 02 20:12:30 centos fail2ban-client[3623]: ERROR No file(s) found for glob /var/www/example.com/log/error.log Apr 02 20:12:30 centos fail2ban-client[3623]: ERROR Failed during configuration: Have not found any log file for apache jail Apr 02 20:12:30 centos systemd[1]: fail2ban.service: control process exited, code=exited status=255 Apr 02 20:12:30 centos systemd[1]: Failed to start Fail2Ban Service.
However, if i use the command
sudo fail2ban-client start
then Fail2Ban Starts normally with no errors. Does anyone have any idea as to why service is not working with Fail2Ban because i believe its also stopping it from starting at boot? -
Leon W about 5 yearsThank you, In the fail2ban local config i have 2 services enabled, apache and sshd. You are correct disabling the apache does allow fail2ban to work. I do have the httpd server running with the log file in the location /var/www/example.com/log/error.log, any idea why fail2ban can't see it?
-
john about 5 yearsi think because it's not the default location for error logs for httpd, please mark my answer as coorect if it helped you.
-
Leon W about 5 yearsI changed the location of my log to /var/log/httpd/example-error.log and fail2ban seems to be happy with that. Thank you for your help!
-
john about 5 yearsyou're welcome :)