使用 sudo systemctl status fail2ban.service 时 Fail2Ban 无法启动

使用 sudo systemctl status fail2ban.service 时 Fail2Ban 无法启动

当我尝试使用sudo service fail2ban restart它重新启动 fail2ban 时,它显示以下错误systemctl 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.

然后当我运行它时,显示此错误,表明 fail2ban 没有以 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.

然而,如果我使用该命令sudo fail2ban-client start,Fail2Ban 会正常启动,不会出现任何错误。有谁知道为什么服务无法与 Fail2Ban 配合使用,因为我相信它也会阻止它在启动时启动?

答案1

抱歉,我想将其作为评论而不是答案,但我没有太多声誉,所以我建议您在 jail.local 文件上为不存在的服务启用监狱,因此转到 /etc/fail2ban/jail.local 并搜索您已启用的内容并删除已启用的单词和句子,然后“sudo systemctl restart fail2ban”并检查“sudo systemctl status fail2ban”

然后它就起作用了!或者这就是我希望的,告诉我它是否有效,我可能会进一步帮助你

相关内容