N系统大全 - 最好的系统光盘下载网站!

当前位置:首页 > 系统教程 > Linux教程 > 详细页面

Linux安装使用fail2ban的方法

时间:2015-04-15 来源:N系统大全

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

 Linux安装使用fail2ban的方法

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

  需要Pytion支持

  python安装

  python安装方法:

  cd /tmp

  wget http://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 https://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访问。

相关信息

  • Linux下的crontab定时执行任务命令详解

    crontab命令主要用于设置周期性被执行的指令,今天小编将给大家详细讲解Linux下的crontab定时执行任务命令,有兴趣的伙伴可以阅读文章了解!...

    2018/03/05

  • Linux系统下tar压缩解压缩命令详解

    tar,是Linux系统的一个命令,非常好用!如果你对tar命令不甚了解的话,可以看看小编为大家整理的tar压缩解压缩命令详解。...

    2018/03/05

系统教程栏目

栏目热门教程

人气教程排行

站长推荐

热门系统下载

公众号