香港服务器香港服务器租用

在Ubuntu 20.04 LTS Focal Fossa上安装Fail2ban

步骤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/

posted @ 2020-09-14 09:38  A5互联  阅读(153)  评论(0编辑  收藏  举报
江苏镇江高防服务器BGP云服务器