12款非常优秀的Linux工具


  1. [root@localhost ~]# cd fail2ban-0.8.11   
  2. [root@localhost fail2ban-0.8.11]# python setup.py install  
  3. [root@localhost fail2ban-0.8.11]# cd files/  
  4. [root@localhost files]# cp ./redhat-initd /etc/init.d/fail2ban  
  5. [root@localhost files]# service fail2ban start  
  6. [root@localhost files]# chkconfig –add fail2ban  
  7. [root@localhost files]# chkconfig fail2ban on 

注:需要配置 iptables 实用,如果重启 iptables 了也要重启 fail2ban,因为 fail2ban 的原理是调用 iptables 实时阻挡外界的攻击。 


  1. [root@localhost ~]# grep -v "^#" /etc/fail2ban/jail.conf | grep -v "^$"   
  2.    [DEFAULT]  
  3.    ignoreip = 127.0.0.1/8# 忽略本机 IP  
  4.    bantime  = 600   #符合规则后封锁时间  
  5.    findtime  = 600  # 在多长时间内符合规则执行封锁如 600 秒达到 3 次则执行  
  6.    maxretry = 3    # 最大尝试次数  
  7.    backend = auto   #日志修改检测日志 gamin、polling 和 auto 这三种  
  8.    usedns = warn  
  9.    [ssh-iptables]  
  10.    enabled  = true# 默认是禁用 false  
  11.    filter   = sshd  
  12.    action   = iptables[name=SSHport=sshprotocol=tcp 
  13.    # sendmail-whois[name=SSH,dest = 收件人邮箱, sender = 发件人邮箱, sendername="Fail2Ban" 
  14.    logpath  = /var/log/sshd.log  # 响应的错误日志一般在 / var/log/secure  
  15.    maxretry = 5    # 尝试错误次数覆盖全局中的 maxretry 

注:默认所有的应用防护都是关闭的,需要我们手动开启。fail2ban.conf 文件是日志信息,jail.conf 文件是保护的具体服务和动作配置信息。


  1. [root@localhost ~]# touch /var/log/sshd.log  
  2. [root@localhost ~]# service fail2ban restart  
  3. [root@localhost ~]# fail2ban-client status    # 查看监控已经开启  
  4. Status   
  5. |- Number of jail:      1  
  6. `- Jail list:           ssh-iptables  
  7. [root@localhost ~]# iptables -L  #iptables 过滤表有 fail2ban 一条规则  
  8. fail2ban-SSH  tcp  —  anywhere             anywhere            tcp dpt:ssh 

 连接会话终端持续化 – Tmux

Tmux 是一个优秀的终端复用软件类似 GNU Screen 比 Screen 更加方面、灵活和高效。为了确保连接 SSH 时掉线不影响任务运行。

rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm(安装第三方 YUM 源)

【声明】:芜湖站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

相关文章