云网
    • 版块
    • 最新
    • 标签
    • 热门
    • 世界
    • 用户
    • 群组
    • 登录

    fail2ban 常用命令

    已定时 已固定 已锁定 已移动 网络技术
    1 帖子 1 发布者 17 浏览
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • N 离线
      node-ccccc
      最后由 node-ccccc 编辑

      一键安装脚本

      wget https://raw.githubusercontent.com/cnnlei/Fail2ban/master/fail2ban.sh && bash fail2ban.sh 2>&1 | tee fail2ban.log
      

      安装后需要改配置文件,才能正常启动
      fail2ban 132行改成Auto改成systemd,随后重启fail2ban

      vim /etc/fail2ban/jail.conf
      
      systemctl restart fail2ban
      

      启动/停止/重启服务

      sudo systemctl start fail2ban    # 启动服务
      sudo systemctl stop fail2ban     # 停止服务
      sudo systemctl restart fail2ban  # 重启服务
      sudo systemctl enable fail2ban   # 设置开机自启
      

      查看服务状态

      sudo systemctl status fail2ban
      

      查看被封禁的 IP

      sudo fail2ban-client status sshd
      

      解封特定 IP

      sudo fail2ban-client set sshd unbanip 192.168.1.100
      

      手动封禁 IP

      sudo fail2ban-client set sshd banip 192.168.1.100
      
      1 条回复 最后回复 回复 引用 0
      • 第一个帖子
        最后一个帖子