按照教程配置 fail2ban,做一下安全防御,最后出现了 Job for fail2ban.service failed 错误

错误提示:# sudo service fail2ban restart

Redirecting to /bin/systemctl restart fail2ban.service Job for fail2ban.service failed because the control process exited with error code. See "systemctl status fail2ban.service" and "journalctl -xe" for details.`
然后我输入 journalctl -xe 出现了如下情况:
图片描述

请问怎么办?

参考的教程是这个:
linux dot cn/article-5067-1 dot html
https://linux.cn/article-5067...

阅读 5.8k
1 个回答

一般是因为fail2ban配置文件错误引起的无法启动,可以查看日志/var/log/fail2ban.log/var/log/messages.log找找哪里出错了。

新建一个新的配置文件/etc/fail2ban/jail.local,一般不建议修改jail.conf
下面是我的配置文件可以参考下,使用的是最新的centos7

[DEFAULT]
# Ban hosts for 86400
bantime = 8640000
maxRetry = 2
destemail = root@localhost
sendername = Fail2Ban
mta = sendmail
# Override /etc/fail2ban/jail.d/00-firewalld.conf:
banaction = iptables-multiport

[sshd]
enabled = true
port = 28116

[sshd-ddos]
enabled = true

[apache-auth]
enabled = true

然后启用fail2ban并设为开机自启

$ systemctl enable fail2ban
$ systemctl start fail2ban

如果最后实在还是不行的话,就找其他的教程参考,一个教程不行就多试试其他的教程。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进