DAILY DOCDAILY DOC
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
  • linux
  • bash alias
  • chmod
  • linux useful command
  • date
  • extract translation from git diff
  • fail2ban
  • globbing
  • localhost
  • mail
  • memo 内存测试
  • nohup(no hang up)
  • setup env
  • ssh

    • ssh 教程
    • github clone
    • ssh.localhost.run 端口转发
    • ssh 安全
  • systemd service
  • 分析ubuntu系统登录日志文件
  • vpn

    • vpn 教程
    • Algo
    • clashX
    • firezone
    • lantern
    • pac 代理配置
    • Setup vpn
    • shadowsocks
    • VPN
    • VPN 速度优化
    • wireguard cron
    • 修改wireguard端口
  • webhook

fail2ban

Install & config

sudo apt update
sudo apt install fail2ban

# Create a copy of the Fail2ban configuration file:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

This will ban any IP address that fails to authenticate via SSH more than 3 times within 10 minutes (600 seconds).

[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
bantime = 2592000 # 30days 

Restart the Fail2ban service to apply the new settings

sudo systemctl restart fail2ban
fail2ban-client status sshd # check sshd jail

# test filter reg
sudo fail2ban-regex --print-all-missed /var/log/nginx/error.log /etc/fail2ban/filter.d/nginx-botsearch.conf

unban

# throught config file 
unbanip = x.x.x.x

# release all banned ip 
sudo fail2ban-client unban --all
Last Updated:
Contributors: rosendo
Prev
extract translation from git diff
Next
globbing