/unifi-network:firewall-auditorfrom unifi-network
Audits UniFi firewall policies for conflicts, redundancies, security gaps, and best practices. Evaluates rules against a documented rubric and produces a deterministic score.
Ships in unifi-network. 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.
Read when SKILL.md points to them; scripts run unread.
Requires: network Optional: none
Verify required tools through MCP discovery before collecting data; discovery alone
does not prove controller connectivity or authorization. If a required server/tool
is missing or a required read fails, stop and report it unavailable. Optional sources
may be skipped only when the report visibly names the missing source and resulting
coverage limits. Verify Network tool discovery with unifi_tool_index; if it is
unavailable, stop and use unifi-network-setup for connection help. Never request secrets.
Every report must include a Coverage and Limitations section: name each requested source and its status (available, unavailable, partial, or capped), requested time window/timezone or current-state collection time, actual filters, returned counts, limits, pagination, and any failed calls or unknown fields. Counts describe retrieved records, not totals unless completeness is established. A successful empty query is an observation; a failed or missing source is unavailable, never an empty result. If a limit is reached, label the source capped unless further bounded reads establish coverage. If completeness cannot be established, label it partial. Do not claim complete coverage, all-clear, or overall health from unavailable, partial, or capped data; say “No concerning activity found in the retrieved records” when appropriate.
Separate Observations (cite source/tool, record ID and timestamp when available), Hypotheses (correlations and alternative explanations), and Identity (only explicit source-backed credential/account attribution, with its limits). Timing, similar names, proximity, or absence of a matching event alone proves neither identity nor cause. A credential event identifies the recorded account, not who physically used it. Missing mappings or clock uncertainty limit correlations.
You audit the firewall configuration on a UniFi network. Your job is to dispatch the right MCP tool calls, evaluate the results against a documented rubric, score the audit deterministically, and present prioritised findings.
The work is split between you and one tiny CLI:
unifi-network MCP tools, evaluate each benchmark, and write findings.scripts/unifi-firewall-score turns those findings into the canonical score. This is the only deterministic boundary — running it on the same findings always produces the same score, which is what makes audit history meaningful.There is no Python script doing the audit for you. There is no HTTP sidecar. You drive the audit; the CLI does the math.
Dispatch these tool calls in a single batch (multiple tool uses in one assistant turn — they are independent and you should not serialise them):
unifi_list_firewall_policiesunifi_list_firewall_zonesunifi_list_legacy_firewall_rulesunifi_list_networksunifi_list_firewall_groupsunifi_list_devicesunifi_get_dpi_stats (optional but useful for HYG-05 / EGR-03 context)If a required tool returns success=false, stop scoring and report the unavailable source in Coverage and Limitations. Optional DPI failure limits only the affected benchmarks. Do not turn missing evidence into a passing benchmark.
For richer per-policy detail (needed by HYG-02 conflict detection and HYG-05 shadowing), follow up with unifi_get_firewall_policy_details for each policy returned by unifi_list_firewall_policies. Batch these calls in parallel as well.
For HYG-02 and HYG-05, also call unifi_list_firewall_policies with include_predefined: true, summary: false and limit: 500. The default call returns at most 50 user-defined policies, and only the full shape carries predefined, which marks UniFi's system policies. Administrators can't edit, reorder or delete those.
Do this before evaluating any benchmark. UniFi has two firewall engines and a site runs exactly one:
| Signal | Engine |
|---|---|
unifi_list_firewall_policies and unifi_list_firewall_zones return entries | zone-based (V2, UniFi Network 9.0+ after migration) |
Both return zero entries and unifi_list_legacy_firewall_rules returns entries | legacy (pre-zone-based) |
| All three return zero entries | indeterminate — see below |
The zone-based tools do not error on a legacy site. They return empty, which is indistinguishable from "no firewall rules configured" unless you check the legacy tool too. Both list tools also return a note field when the controller reports nothing; treat its presence as a prompt to check the legacy engine, not as a finding in itself.
Record the detected engine and state it in the report header, so a reader knows which ruleset was actually examined.
Never score segmentation from an engine you did not read. If the site is legacy, evaluate SEG-01 through SEG-04 against the legacy rules, not against the empty zone-based result. Reporting "no VLAN segmentation enforced" because the zone-based endpoints were empty is a false critical — it is the specific failure this step exists to prevent.
If the engine is indeterminate (all three empty), do not emit segmentation criticals. Emit a single info finding stating that no firewall configuration could be retrieved and that segmentation could not be assessed, and continue with the non-segmentation benchmarks as partial coverage. Withhold the overall score/status and history entry when any benchmark cannot be assessed; report only supported findings. An audit that cannot see the rules must say so rather than score them as absent.
Walk through each benchmark in references/security-benchmarks.md in order: SEG-01 → SEG-04, EGR-01 → EGR-03, HYG-01 → HYG-05, TOP-01 → TOP-04. For each benchmark, the reference document specifies:
critical, warning, or info)fix template you can include in the findingA benchmark may produce zero, one, or many findings — one per offending instance. For example, TOP-02 (firmware updates) produces one finding per device with upgradeable=true, not one finding total. Per-instance counting is what makes the score reflect real exposure (rubric §"Why per-instance deductions").
For each instance, build a finding object:
{
"benchmark_id": "SEG-01",
"severity": "critical",
"message": "No rule blocks IoT VLAN traffic to private networks.",
"fix": {
"tool": "unifi_create_firewall_policy",
"params": { "name": "Block IoT to Internal", "action": "REJECT", ... }
}
}
The fix block is optional but include it whenever the benchmark reference shows a remediation template.
Pipe the findings through the scoring CLI. This is the only part of the audit where math happens — keep it that way so trend tracking stays comparable.
# Resolve scripts/unifi-firewall-score relative to this skill directory.
echo '{"findings": [...]}' | "<firewall-auditor-skill-dir>/scripts/unifi-firewall-score"
The CLI returns:
{
"rubric_version": 1,
"overall_score": 73,
"overall_status": "needs_attention",
"categories": {
"segmentation": {"score": 14, "max": 25, "deduction": 11, "count": 4},
"egress_control": {"score": 23, "max": 25, "deduction": 2, "count": 1},
"rule_hygiene": {"score": 15, "max": 25, "deduction": 10, "count": 5},
"topology": {"score": 21, "max": 25, "deduction": 4, "count": 2}
}
}
Do not compute the score yourself. The CLI is stable across versions; your arithmetic is not.
Only score and append history when every scored benchmark has sufficient evidence. A partial audit must not receive a healthy overall score.
Maintain a single audit history file at ${UNIFI_SKILLS_STATE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/unifi-mcp/skills}/audit-history.json. The file is a JSON array of {timestamp, overall_score, overall_status, rubric_version} entries.
STATE_DIR="${UNIFI_SKILLS_STATE_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/unifi-mcp/skills}"
mkdir -p "$STATE_DIR"
HIST="$STATE_DIR/audit-history.json"
[ -f "$HIST" ] || printf '%s\n' '[]' > "$HIST"
# Append the score CLI output ($SCORE_JSON) to the history file. The path and
# the JSON travel as arguments, so no data is interpolated into the code and a
# message field containing quotes cannot break the script.
python3 - "$HIST" "$SCORE_JSON" <<'PY'
import datetime, json, sys
hist_path, score_json = sys.argv[1], sys.argv[2]
score = json.loads(score_json)
entry = {
"timestamp": datetime.datetime.now(datetime.timezone.utc).isoformat(),
"overall_score": score["overall_score"],
"overall_status": score["overall_status"],
"rubric_version": score["rubric_version"],
}
try:
with open(hist_path) as handle:
hist = json.load(handle)
except FileNotFoundError:
hist = []
hist.append(entry)
with open(hist_path, "w") as handle:
json.dump(hist[-50:], handle, indent=2)
PY
Keep the last 50 entries (enough for ~a year of weekly audits).
Compare against the previous entry in the history file. Report:
previous_score — the prior entry's score, or null if this is the first auditchange — signed integer delta (e.g., +5, -3)If rubric_version differs from the prior entry, do not compute a trend — the scoring model changed and historical scores are not comparable. Tell the user the rubric was updated and a fresh trend baseline starts now.
Format depends on user intent:
Default (interactive): human-readable summary
zone-based, legacy, or indeterminate)fix tool nameState the engine explicitly. A reader needs to know which ruleset was examined to trust a segmentation score, and on a legacy site the zone-based remediation templates do not apply.
On request ("give me JSON" / "machine-readable"): emit the full report as JSON with this shape:
{
"timestamp": "...",
"overall_score": 73,
"overall_status": "needs_attention",
"firewall_engine": "zone-based",
"categories": { ... from CLI ... },
"findings": [ ... all per-instance findings ... ],
"trend": { "previous_score": 68, "change": "+5" }
}
references/scoring-rubric.md)| Score | Rating | Meaning |
|---|---|---|
| 80–100 | Healthy | Follows best practices with minor gaps |
| 60–79 | Needs Attention | Notable gaps; address on a planned schedule |
| 0–59 | Critical | Significant exposure requiring immediate remediation |
For each finding, do not call mutating tools yourself. The auditor reads; the firewall-manager skill writes. For each remediation:
fix.tool and fix.params from the report.Priority order: critical findings (SEG-01 / SEG-02 / SEG-03 / HYG-02 / TOP-01) first, then warnings, then info. Use this same order when summarising the report — never bury a critical finding under a long info list.
references/security-benchmarks.md is authoritative; do not invent new checks. If you encounter a real-world issue not covered by the 16 benchmarks, report it as a freeform observation outside the scored categories — do not invent a new benchmark_id.unifi-firewall-score.rubric_version mismatch with the prior history entry means the math changed; report the new baseline and explain why no trend is shown.unifi_list_legacy_firewall_rules. Scoring a legacy site as having no segmentation is the single most damaging false positive this audit can produce, because it reports a correctly-segmented network as critically exposed.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sirkirby/unifi-mcp --plugin unifi-network6 skills in this plugin
/firewall-managerManage UniFi firewall policies using natural language — create, modify, and review firewall rules, content filters, and traffic policies. Use when asked to block traffic, create firewall rules, manage content filtering, set up time-based access controls, or review firewall configuration./network-health-checkRun a UniFi network health check — diagnose device status, connectivity issues, firmware updates, and system health. Use when asked to check network health, find what's down, diagnose connectivity issues, or get a network status summary./unifi-networkHow to manage UniFi network infrastructure — devices, clients, firewall, VPN, routing, WLANs, Traffic Flows, and statistics. Use this skill when the user mentions UniFi, Ubiquiti, network management, WiFi configuration, firewall rules, port forwarding, VPN, QoS, bandwidth, traffic flows, connected clients, network devices, or any UniFi networking task.Other plugins' skills for the same job