sh 安装Fail2ban以保护CentOS 6上的SSH

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 安装Fail2ban以保护CentOS 6上的SSH相关的知识,希望对你有一定的参考价值。

# part 1: installation

yum install epel-release
yum install fail2ban

# part 2: configure local settings
#
# You can find a file with default values called `/etc/fail2ban/jail.conf`. 
# Since this file may be overwritten by package upgrades, we shouldn't edit it in-place. 
# Instead, we'll write a new file called `/etc/fail2ban/jail.local`. 
# Any values defined in `jail.local` will override those in `jail.conf`.
# https://www.digitalocean.com/community/tutorials/how-to-protect-ssh-with-fail2ban-on-centos-7
#
# below settings are for fail2ban v0.9.6, older versions have DIFFERENT options

vim /etc/fail2ban/jail.local
  [DEFAULT]
  bandtime = 3600
  
  [sshd]
  enabled = true

# part 3: start fail2ban-server

service fail2ban start
service fail2ban status
fail2ban-client status sshd

# part 4: start fail2ban service on boot

chkconfig --list fail2ban
# fail2ban has been set to start on boot by default, if not, then:
chkconfig --add fail2ban

以上是关于sh 安装Fail2ban以保护CentOS 6上的SSH的主要内容,如果未能解决你的问题,请参考以下文章

服务器安全神器,Linux 上安装 Fail2Ban 保护 SSH

在Ubuntu 22.04上使用Fail2Ban保护SSH

CentOS 7安装fail2ban+Firewalld防止SSH爆破

fail2ban 的安装配置

fail2ban CentOS7安装

sh 在CentOS 6上安装ElasticSearch