广州活力数据恢复中心

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1939|回复: 0

ubuntu linux fail2ban相关信息和教程

[复制链接]

860

主题

1784

帖子

9514

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9514
QQ
发表于 2020-9-25 13:49:42 | 显示全部楼层 |阅读模式
ubuntu linux fail2ban相关信息和教程

安装fail2bank
  1. sudo apt update && sudo apt install fail2ban
复制代码
安装完后查看fail2ban运行状态
  1. sudo systemctl status fail2ban
复制代码
fail2ban默认两个配置文件
  1. /etc/fail2ban/jail.conf
  2. /etc/fail2ban/jail.d/defaults-debian.conf
复制代码
不推荐直接修改这两个文件, 因为每次升级都是复写这两个文件.
备份配置文件
  1. sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf_backup
复制代码


配置文件复制一份并全名*.local后缀.
  1. sudo cp /etc/fail2ban/jail.{conf,local}
复制代码
然后修改jail.local的配置
[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
bantime = 1000d

修改完后重启fail2ban
  1. sudo systemctl restart fail2ban
复制代码



解封ip
  1. sudo fail2ban-client set sshd unbanip 1.1.1.1
复制代码
封ip
  1. sudo fail2ban-client set sshd unbanip 1.1.1.1
复制代码



fail2ban-client status
  1. Status
  2. |- Number of jail:        2
  3. `- Jail list:        sshd, vsftpd-iptables
复制代码


fail2ban-client status sshd
  1. Status for the jail: sshd
  2. |- Filter
  3. |  |- Currently failed:        0
  4. |  |- Total failed:        0
  5. |  `- File list:        /var/log/auth.log
  6. `- Actions
  7.    |- Currently banned:        0
  8.    |- Total banned:        0
  9.    `- Banned IP list:
复制代码




fail2ban-client status vsftpd-iptables命令查看 vsftpd相关的信息(banned ip之类):
  1. Status for the jail: vsftpd-iptables
  2. |- Filter
  3. |  |- Currently failed:        0
  4. |  |- Total failed:        0
  5. |  `- File list:        /var/log/vsftpd.log
  6. `- Actions
  7.    |- Currently banned:        0
  8.    |- Total banned:        0
  9.    `- Banned IP list:        
复制代码


查看fai2ban ssh相应的log在那个位置
  1. fail2ban-client status sshd
复制代码

fail2ban auth.log位置
  1. /var/log/auth.log
复制代码









硬盘数据恢复/优盘内存卡数据恢复/服务器数据恢复
data recovery service www.rflashdata.com 数据热线+86 18620923827(微信whatsapp)
buffalo 隨身碟數據救援 bitlocker WDV2 lacie EFS等加密硬盘数据恢复,指纹爱国者加密优盘数据恢复 +86 18620923827
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|硬盘FLASH数据恢复论坛

GMT+8, 2024-5-15 11:56 , Processed in 0.053035 second(s), 27 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表