/ubuntu-security:fail2banfrom ubuntu-security
Install, configure and operate fail2ban on Ubuntu — sshd jail reading the systemd journal, ban time and retry thresholds, ignoring the LAN/VPN so the user can't ban themselves, list active jails and banned IPs, unban an address, and check whether fail2ban is the reason a client can't connect. Use when the user says "set up fail2ban", "protect ssh from brute force", "who is banned", "unban <ip>", "fail2ban banned me", or "is fail2ban working".
Ships in ubuntu-security. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Mostly for internet-facing servers. On a LAN-only desktop with sshd off it does nothing useful; say so if asked to install it there.
systemctl is-active fail2ban
sudo fail2ban-client status # list of jails
sudo fail2ban-client status sshd # failures, currently banned IPs
sudo fail2ban-client get sshd banip --with-time # bans with expiry (0.11+)
sudo fail2ban-client set sshd unbanip <ip> # unban
sudo fail2ban-client unban --all # unban everything
sudo zgrep -h 'Ban ' /var/log/fail2ban.log* | tail -20
"Fail2ban banned me": a client getting Connection refused/timeouts after a few bad
logins is the classic sign. Check status sshd for its IP, unban, then add the
network to ignoreip.
sudo apt install -y fail2ban
Never edit jail.conf (overwritten on upgrade); write /etc/fail2ban/jail.local:
[DEFAULT]
# addresses that are never banned: localhost, the LAN, the VPN range
ignoreip = 127.0.0.1/8 ::1 <lan-cidr> <vpn-cidr>
bantime = 1h
findtime = 10m
maxretry = 5
# progressive bans for repeat offenders
bantime.increment = true
backend = systemd
[sshd]
enabled = true
# custom port? list it so the ban covers it
port = ssh
backend = systemd matters on Ubuntu releases where /var/log/auth.log may not exist
(no rsyslog); the journal always has sshd's messages. Ubuntu's package already sets
this in /etc/fail2ban/jail.d/defaults-debian.conf on recent releases; jail.local
makes it explicit.
sudo fail2ban-client -t # config test
sudo systemctl enable --now fail2ban
sudo systemctl restart fail2ban # after edits
sudo fail2ban-client status sshd
If status sshd shows Total failed: 0 while the journal plainly has failed logins,
the jail's journal match misses the sshd-session process (fail2ban older than 1.1 on
OpenSSH 9.8+). Override in the [sshd] section:
journalmatch = _SYSTEMD_UNIT=ssh.service, restart, and re-check.
The default banaction on Ubuntu inserts its own nftables/iptables chain
(f2b-sshd), independent of ufw rules; bans work whether ufw is active or not. If
the user wants bans visible in ufw status, set banaction = ufw in [DEFAULT]
(bans then appear as numbered REJECT/DENY rules — and firewall-remove must not
delete them by number while fail2ban is managing them).
Only enable for services that exist on the host: nginx-http-auth, nginx-botsearch,
apache-auth, postfix, dovecot, recidive (long bans for repeat offenders across
jails). Each needs the service's log path or journal match; sudo fail2ban-client -d
dumps the resolved config for checking.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
18 skills in this plugin
/av-installInstall and initialise malware and rootkit scanning on Ubuntu — the core set (ClamAV engine + clamd daemon + freshclam updater, ClamTk GUI on desktops, rkhunter) and, on request, the advanced layer (Lynis hardening audit, chkrootkit, AIDE file-integrity baseline, debsecan). Detects what is already installed, picks a reports folder, runs the first definitions update and baselines. Use when the user says "install antivirus", "set up clamav", "install rkhunter / lynis / aide / chkrootkit", "set up malware scanning", or when malware-scan finds no scanners installed./av-update-definitionsRefresh signature databases and data for every installed scanner on Ubuntu — freshclam (ClamAV), rkhunter --update, Lynis version check, debsecan CVE list — and report one status line per tool, without re-baselining rkhunter or AIDE. Also explains stale ClamAV signatures (freshclam service down, mirror rate-limiting). Use when the user says "update antivirus definitions", "refresh signatures", "update clamav", "is clamav up to date", or before a scan when signatures are old./complementary-pluginsList and install plugins that complement ubuntu-security: hardware-auth-keys, security-auditor, ubuntu-admin. Use on "related plugins"./fingerprint-setupSet up a fingerprint reader for login, lock screen and sudo on an Ubuntu laptop or desktop — check the reader is supported by libfprint, install fprintd and libpam-fprintd, enroll fingers, enable fingerprint auth with pam-auth-update, verify, and troubleshoot unsupported or flaky readers. Use when the user says "set up the fingerprint reader", "enable fingerprint login", "fingerprint for sudo", "enroll my fingerprint", or "fingerprint reader not working"./firewall-allowAdd a scoped firewall exemption with ufw on an Ubuntu desktop or server — open a port, port range or app profile (OpenSSH, CUPS, KDE Connect, Samba, Syncthing...) to the LAN, a VPN interface, one host, or anywhere, with a comment, without duplicating existing rules, and verify it actually took effect. Use when the user says "open port X", "allow <service> through the firewall", "add a firewall exemption", "let my phone/printer/other machine connect", "unblock <port>", or when another skill finds ufw blocking something it needs./firewall-diagnoseWork out whether the host firewall (ufw) is what is blocking a connection on an Ubuntu desktop or server, and if so which rule or policy — reads UFW BLOCK lines from the kernel log (journalctl -k) and /var/log/ufw.log, checks logging is on, walks first-match rule order, interface and address-family mismatches, services bound to localhost, and Docker-published ports that bypass ufw. Diagnoses only; hands the fix to firewall-allow / firewall-remove. Use when the user asks "is the firewall blocking X?", "why can't my phone / other machine connect to this one", "KDE Connect / Samba / printer / SSH doesn't work", "port X is unreachable", "ufw is blocking something", or "I opened the port but it still doesn't work".ubuntu-security@danielrosehill is listed by danielrosehill/claude-code-plugins — review the source before installing
npx claudepluginhub danielrosehill/claude-code-plugins --plugin ubuntu-security