步骤1.首先,通过apt在终端中运行以下以下命令,确保所有系统软件包都是最新的。
sudo apt update
sudo apt upgrade
步骤2.在Ubuntu 20.04上安装Fail2ban。
运行以下命令以安装Fail2ban:
sudo apt install fail2ban
完成后,Fail2ban服务将自动启动。您可以使用以下命令验证Fail2ban:
sudo systemctl status fail2ban
步骤3. Fail2ban配置。
默认的fail2ban安装带有两个配置文件,/etc/fail2ban/jail.conf并且/etc/fail2ban/jail.d/defaults-debian.conf您可以了解更多关于监狱这里。要开始配置Fail2ban服务器打开,请使用nano编辑器打开jail.local文件:
[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1/8 ::1 123.123.123.123 192.168.1.0/24

# "bantime" is the number of seconds that a host is banned.
bantime = 2d

# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 600
maxretry = 5

# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = admin@idroot.us
sender = root@idroot.us
重新启动Fail2ban服务以使更改生效:
sudo systemctl restart fail2ban
恭喜你!您已经成功安装了Fail2Ban。A5互联https://www.a5idc.net/

相关文章:

  • 2021-09-01
  • 2021-06-22
  • 2022-02-15
  • 2021-05-24
  • 2021-11-29
  • 2021-08-25
  • 2021-09-17
  • 2021-10-24
猜你喜欢
  • 2021-08-17
  • 2021-06-08
  • 2021-08-29
  • 2021-11-28
  • 2022-02-23
  • 2021-11-11
  • 2022-03-07
相关资源
相似解决方案