linux 防止登录爆破 自动限制错误登录

流程:

1.装epel的源
2.yum -install fail2ban
3.vim /etc/fail2ban/jail.d/xxoo.local
[ssh-iptables]
enabled = true
filter = sshd
action = iptables[name=SSH, port=11122, protocol=tcp]
logpath = /var/log/secure
maxretry = 3
4.service fail2ban start
搞定




在CentOS 上安装EPEL
要想安装EPEL,我们先要下载EPEL的rpm安装包。

CentOS/RHEL下的6.x和5.x版本下载页面如下

http://download.fedoraproject.org/pub/epel/6/i386/repoview/epel-release.html

以上网址可能会被重定向到特定的镜像站而加快下载速度。这个页面包含可以直接获取到rpm包的下载链接。直接的下载链接如下:

http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

根据你的CentOS 版本来选择正确的下载地址。

请注意EPEL 的安装包是独立编译的,所以它可以安装在32位和64位系统中。

1. 确认你的CentOS 的版本

首先通过以下命令确认你的CentOS 版本

$ cat /etc/redhat-release 
CentOS release 6.4 (Final)
2. 下载EPEL 的rpm 安装包

现在从上面的地址下载CentOS 版本所对应的EPEL 的版本

$ wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
3. 安装EPEL

通过以下命令安装EPEL 软件包

$ sudo rpm -ivh epel-release-6-8.noarch.rpm


$ sudo rpm -ivh epel-release*
5. 检查EPEL 源

安装好EPEL 源后,用yum 命令来检查是否添加到源列表

# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.vonline.vn
* epel: buaya.klas.or.id
* extras: centos-hn.viettelidc.com.vn
* updates: mirrors.fibo.vn
repo id        repo name                                              status
base           CentOS-6 - Base                                         6,381
epel           Extra Packages for Enterprise Linux 6 - x86_64         10,023
extras         CentOS-6 - Extras                                          13
nginx          nginx repo                                                 47
updates        CentOS-6 - Updates                                      1,555
repolist: 18,019
EPEL已经在repo 后列出,并且显示提供了上万个软件包,所以EPEL 已经安装到你的CentOS了。

EPEL源的配置安装到了 /etc/yum.repos.d/epel.repo 文件。

现在来试一下从EPEL 获取软件包

$ sudo yum install htop
引用:https://linux.cn/article-2324-1.html

引用:http://www.binarytides.com/setup-epel-repository-centos/

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

桂ICP备19000498号-3