/ubuntu-security:firewall-setupfrom ubuntu-security
First-time ufw setup on an Ubuntu desktop or server — install if missing, set default policies (deny incoming, allow outgoing), low logging, add narrow allows only for services the user actually runs (SSH first on a remote box, then e.g. mDNS, KDE Connect, Syncthing, Samba, CUPS on a desktop, or HTTP/HTTPS on a web server), enable, verify, and save a baseline. Use when the user says "set up ufw", "enable the firewall", "configure a firewall on this machine", "first-time firewall setup", or when firewall-status finds ufw missing or inactive and the user wants it on.
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.
A sensible default that doesn't surprise the user: deny unsolicited inbound, allow
outbound, and keep reachable only what they actually use. If ufw is already active
with rules, this is not a first-time setup: report the current state
(firewall-status) and use firewall-allow / firewall-remove instead.
command -v ufw || sudo apt install -y ufw
sudo ufw status verbose
systemctl is-active firewalld 2>/dev/null # if active: stop here and ask; don't run two front-ends
echo "${SSH_CONNECTION:-local session}" # remote? first field is the client IP
sudo ss -tulnpH | awk '$5 !~ /^(127\.|\[::1\])/' # what is listening beyond localhost
Decide the profile: desktop/laptop or server, and local or remote (SSH) session.
Cross-reference listening sockets with this list and confirm each with the user.
Scope defaults to the LAN CIDR (derive it: ip -4 -o addr show scope global).
| Service | Rule (prefer the app profile when it exists) | Typical on |
|---|---|---|
| SSH | allow OpenSSH or allow from <lan-cidr> to any app OpenSSH | servers; desktops only if sshd runs |
| mDNS / Avahi (printer, Chromecast discovery) | allow from <lan-cidr> to any port 5353 proto udp | desktop |
| KDE Connect / GSConnect | allow from <lan-cidr> to any app KDEConnect (or 1714:1764 tcp+udp) | desktop |
| Syncthing | allow from <lan-cidr> to any app syncthing (22000 tcp+udp, 21027 udp) | either |
| Samba file sharing | allow from <lan-cidr> to any app Samba | either |
| CUPS printer sharing | allow from <lan-cidr> to any app CUPS | desktop sharing a printer |
| HTTP / HTTPS | allow 'Nginx Full' / allow 'Apache Full' / allow 80,443/tcp | web server (usually public) |
Always add comment '<purpose> <scope>'.
# only if the user wants to wipe existing (inactive) rules: destructive
# sudo ufw --force reset
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw logging low # blocked packets only, rate-limited; enough for firewall-diagnose
# REMOTE SSH SESSION: allow SSH BEFORE enabling, or the session is cut.
sudo ufw allow OpenSSH comment 'ssh'
# custom sshd port? check `sudo sshd -T | grep -i ^port` and on 22.10+ `systemctl cat ssh.socket`
# sudo ufw allow 2222/tcp comment 'ssh custom port'
# the opt-in allows the user picked, e.g.
sudo ufw allow from <lan-cidr> to any app KDEConnect comment 'KDE Connect LAN'
sudo ufw --force enable
sudo ufw status verbose
Server notes:
sudo ufw limit OpenSSH instead of allow throttles
brute-force attempts (6 new connections / 30 s per source). Use it only if the
user wants it; fail2ban is the alternative./etc/default/ufw has IPV6=yes by default; rules apply to both families.Desktop notes:
limit rules on a desktop.After enabling, confirm the session survived (remote) and that the allowed services
still work from a client. sudo journalctl -k -f | grep 'UFW BLOCK' while the user
tries their usual workflows shows anything still refused → firewall-allow.
STATE="${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/ubuntu-security/ufw"
mkdir -p "$STATE"
sudo ufw show added > "$STATE/baseline-$(date +%Y-%m-%dT%H%M%S).rules"
firewall-status diffs against this; firewall-remove can reset to it. Never
overwrite a baseline; write a new one if the user wants a new reference point.
If Docker is installed, published container ports bypass ufw (see
firewall-status §5). Say so once if docker ps shows 0.0.0.0: publishes; don't
change Docker's configuration as part of this skill.
sudo ufw disable turns filtering off and keeps the rules for later re-enable.
What SKILL.md sets; muted values are Claude Code's defaults
ubuntu-security@danielrosehill is listed by danielrosehill/claude-code-plugins — review the source before installing
npx claudepluginhub danielrosehill/claude-code-plugins --plugin ubuntu-security18 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".Other plugins' skills for the same job