Linux安装使用fail2ban的方法


Fail2ban是一款非常使用的软件,它能够监控系统日志,能够有效的防止ssh被暴力破解,下面小编将针对Fail2ban在Linux下的安装和使用给大家做个介绍,一起来了解下吧。

通过iptables, tcp-wrapper, shorewall等方式阻止此IP的访问。

需要Pytion支持

python安装

python安装方法:

cd /tmp

wget python.org/ftp/python/2.7.3/Python-2.7.3.tgz

tar xzf Python-2.7.3.tgz

cd Python-2.7.3

。/configure

make && make install

rm -rf /usr/bin/python

ln -s /tmp/Python-2.7.3/python /usr/bin/

fail2ban安装

cd /tmp

wget github.com/downloads/fail2ban/fail2ban/fail2ban_0.8.6.orig.tar.gz

tar xzf fail2ban_0.8.6.orig.tar.gz

cd fail2ban-fail2ban-a20d1f8/

。/setup.py install

cp files/RedHat-initd /etc/init.d/fail2ban

chmod 755 /etc/init.d/fail2ban

配置fail2ban日志轮循:

vi /etc/logrotate.d/fail2ban

写入:

/var/log/fail2ban.log {

weekly

rotate 7

missingok

compress

postrotate

/etc/init.d/fail2ban restart 1》/dev/null || true

endscript

}

fail2ban使用方法

配置文件:

/etc/fail2ban/

├── action.d

│ ├── dummy.conf

│ ├── hostsdeny.conf

│ ├── iptables.conf

│ ├── mail-whois.conf

│ ├── mail.conf

│ └── shorewall.conf

├── fail2ban.conf

├── fail2ban.local

├── filter.d

│ ├── apache-auth.conf

│ ├── apache-noscript.conf

│ ├── couriersmtp.conf

│ ├── postfix.conf

│ ├── proftpd.conf

│ ├── qmail.conf

│ ├── sasl.conf

│ ├── sshd.conf

│ └── vsftpd.conf

├── jail.conf

└── jail.local

目录action.d下的文件指定满足条件时执行的一些动作,比如使用iptables禁止ip访问。


上一篇:Ubuntu通过dpkg命令启动deb安装包的技巧

下一篇:Linux系统调用fork函数的方法


fail2ban fail2ban安装 fail2ban配置
Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器