fail2ban

Use Fail2Ban to protect servers from brute-force attacks. Suitable for blocking repeated failed logins, protecting SSH, defending web servers from brute-force attempts, or automatically banning malicious IPs.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
7

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "fail2ban" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-0a1b0c1214e0bed19ca421ad4948b1bb4f07bdbd3178f8252677df6f10791019. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Use Fail2Ban to protect servers from brute-force attacks. Suitable for blocking repeated failed logins, protecting SSH, defending web servers from brute-force attempts, or automatically banning malicious IPs.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: fail2ban
description: >-
  Protect servers from brute force attacks with Fail2Ban. Use when a user asks
  to block repeated failed login attempts, protect SSH, secure web servers from
  brute force, or ban malicious IPs automatically.
license: Apache-2.0
compatibility: 'Linux'
metadata:
  author: terminal-skills
  version: 1.0.0
  category: devops
  tags:
    - fail2ban
    - brute-force
    - ssh
    - security
    - firewall

Fail2Ban

Overview

Fail2Ban monitors log files for failed authentication attempts and bans offending IPs using iptables/nftables. Protects SSH, Nginx, Apache, Postfix, and any service with log-based authentication.

Instructions

Step 1: Install

sudo apt install fail2ban
sudo systemctl enable fail2ban

Step 2: Configure

# /etc/fail2ban/jail.local — Custom configuration (never edit jail.conf)
[DEFAULT]
bantime = 1h
findtime = 10m
maxretry = 5
banaction = iptables-multiport

[sshd]
enabled = true
port = ssh
maxretry = 3
bantime = 24h

[nginx-http-auth]
enabled = true
port = http,https
maxretry = 5

[nginx-botsearch]
enabled = true
port = http,https
maxretry = 2
bantime = 7d

Step 3: Monitor

sudo fail2ban-client status               # list active jails
sudo fail2ban-client status sshd           # show banned IPs
sudo fail2ban-client set sshd unbanip 1.2.3.4   # unban
sudo fail2ban-client set sshd banip 5.6.7.8     # manual ban

Guidelines

  • Always create jail.local — jail.conf gets overwritten on updates.
  • Start conservative: 5 retries, 1h ban. Adjust based on logs.
  • For modern alternative with community threat sharing, consider CrowdSec.
  • Use fail2ban-regex to test custom filters before deploying.

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 提供完整的 Fail2Ban 部署与配置流程,解决服务器暴力破解防护这一运维刚需
  • 覆盖 SSH、Nginx 等常见服务,具备高实用价值与广泛适用性
Trigger Precision92/100

Highlights

  • 触发描述精准覆盖典型使用场景,边界清晰,不易误触或漏触
Structure and Standards95/100

Areas to improve

  • description 内容重复 Reported severity: Minor

    顶层 frontmatter 与 skill_body 内部均包含 description 字段,存在冗余

    Recommendation: 建议移除 skill_body 内部的 description 字段,保持唯一性

Highlights

  • 文档结构清晰,分步骤说明完整,包含具体配置示例与操作命令
  • frontmatter 元数据完整,符合规范要求
Execution Reliability90/100

Highlights

  • 提供标准安装命令与配置文件路径,参数设置合理且符合最佳实践
  • 包含状态监控与手动封禁/解封操作,覆盖主要使用场景
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.