360 Secure SkillHub
360 安全技能中心

fail2ban Reporter

通过 bash 脚本监控 fail2ban 封禁记录,将攻击 IP 上报至 AbuseIPDB,并可选通过 Telegram 发送通知;支持手动查询指定 IP、查看封禁统计、安装或卸载自动上报动作,日志写入 /var/log/abuseipdb-reports.log。

jestersimpps
jestersimpps
热度 92.76
最近更新 2026-05-11 15:50:57
分类:安全依赖:代码执行 / 第三方 API / 读写文件应用场景:DevOps / 自动化脚本 / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add fail2ban-reporter
Metadata
name
fail2ban-reporter
description
Auto-report fail2ban banned IPs to AbuseIPDB and notify via Telegram. Use when monitoring server security, reporting attackers, or checking banned IPs. Watches fail2ban for new bans, reports them to AbuseIPDB, and sends alerts.

fail2ban Reporter

Monitor fail2ban bans and auto-report attackers to AbuseIPDB.

Setup

  1. Get a free AbuseIPDB API key at https://www.abuseipdb.com/account/api
  2. Store it: pass insert abuseipdb/api-key
  3. Install the monitor: bash {baseDir}/scripts/install.sh

Manual Usage

Report all currently banned IPs

bash {baseDir}/scripts/report-banned.sh

Check a specific IP

bash {baseDir}/scripts/check-ip.sh <ip>

Show ban stats

bash {baseDir}/scripts/stats.sh

Auto-Reporting

The install script sets up a fail2ban action that auto-reports new bans.

bash {baseDir}/scripts/install.sh    # install auto-reporting
bash {baseDir}/scripts/uninstall.sh  # remove auto-reporting

Heartbeat Integration

Add to HEARTBEAT.md to check for new bans periodically:

- [ ] Check fail2ban stats and report any unreported IPs to AbuseIPDB

Workflow

  1. fail2ban bans an IP → action triggers report-single.sh
  2. Script reports to AbuseIPDB with SSH brute-force category
  3. Sends Telegram notification (if configured)
  4. Logs report to /var/log/abuseipdb-reports.log

API Reference

See references/abuseipdb-api.md for full API docs.