Firewall AIops

io.github.AIops-tools由 GitHub 帳號 AIops-tools 發布v0.16.0更新於 Oct 30, 2026

Governed OPNsense + pfSense firewall ops: rules, NAT, VPN, DHCP, RCA. 35 tools.

概覽

AI 產生的概覽

針對 OPNsense 與 pfSense 防火牆的受治理、可稽核 MCP 伺服器:讀取規則、NAT、VPN、DHCP 與日誌,執行 RCA 分析並進行有稽核紀錄的寫入操作。

可以做什麼
  • 檢視系統狀態:韌體、健康、介面、閘道
  • 讀取過濾規則、命中統計、狀態表、NAT、別名、VPN 工作階段與 DHCP 租約
  • 查詢防火牆日誌、狀態表與流量大戶
  • 執行閘道健康、規則命中與遮蔽、被封鎖流量的 RCA 分析
  • 執行受治理寫入:切換規則、新增或移除別名項目、清除狀態、重啟服務
  • 以試執行預覽套用變更、重新設定或重開機,並列出與套用復原紀錄
適用情境
適合需要以相同工具名稱巡檢或操作混合環境中 OPNsense 與 pfSense 防火牆的情境,例如排查連線問題、稽核規則,或進行具稽核軌跡的小幅可逆變更。
執行需求
透過 uv 或 pipx 安裝的本機 Python 套件,以 stdio 執行。需要含各目標平台、主機、連接埠與使用者名稱的設定檔,以及由 FIREWALL_AIOPS_MASTER_PASSWORD 環境變數解鎖的加密金鑰庫。需能連線防火牆 REST API;pfSense 需安裝 RESTAPI 套件。
安裝前請注意
寫入操作是真實的:規則、別名、狀態、服務、套用變更/重新設定與重開機,其中重開機不可逆。沒有唯讀開關或核准關卡,應限制 API 使用者權限以降低風險。主密碼可解鎖已儲存的防火牆憑證。REST 路徑依公開 API 建模,尚未在真實防火牆上驗證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Firewall AIops,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Firewall AIops

Audit availability: Real writes require a committed pending audit row and stop before contacting the platform if storage is unavailable. Reads and previews may continue with a warning; new audit rows store outcome summaries rather than full responses.

Governed, audited AI-ops for OPNsense and pfSense firewalls — for AI agents (via MCP) and humans (via CLI).

Disclaimer: Community-maintained open-source project. Not affiliated with, endorsed by, or sponsored by the OPNsense project, Deciso, Netgate, or the pfSense project. OPNsense, pfSense and Netgate are trademarks of their respective owners. MIT licensed.

firewall-aiops speaks to two firewall platforms behind one MCP server — OPNsense (REST API under /api/..., API key+secret via HTTP Basic auth) and pfSense (REST API v2 under /api/v2/... from the pfSense-pkg-RESTAPI package, API key via an X-API-Key header) — with the same tools working on both. Each target in the config names its own platform; a name-keyed platform registry selects the API shape (auth + resource paths), so an agent never has to know which firewall it is talking to.

Every tool runs through a built-in governance harness (vendored, zero external dependency): audit log, token/call budget with runaway circuit-breaker, descriptive risk-tier labelling, undo-token recording, and prompt-injection sanitisation.

Why this exists

  • One server, both firewalls — OPNsense and pfSense in a mixed estate, spoken to through identical tool names. Adding a third firewall later is a new platform descriptor, not a rewrite.
  • Read the whole firewall — firmware/health, interfaces & gateways, filter rules (with hit counts and state table), NAT (port-forward / outbound / 1:1), aliases, VPN (WireGuard / OpenVPN / IPsec), DHCP leases & reservations, and the firewall log.
  • Flagship RCA analyses — transparent heuristics that show their numbers, never a black-box verdict: gateway_health_rca (WAN loss/latency/down → cause + action), rule_hit_and_shadow_analysis (never-hit + shadowed/redundant rules), and blocked_traffic_rca (top blocked sources/ports → scan / brute-force / probe).
  • Governed writes — toggle a rule, add/remove an alias entry (reversible, undo-recorded from the fetched before-state), flush states, restart a service, and the "make it live" commit (apply_changes / reconfigure) and reboot at risk=high with a dry-run preview. Every write, reversible or not, lands an audit row.

What this tool does, and does not, decide

It delivers firewall operations — reads and writes — accurately and efficiently, and records every one of them. It does not decide whether a write is allowed to happen. That is the agent's judgement, or the permission of the account you connect it with: give the OPNsense/pfSense API user a read-only role, and the writes fail at the server — the place that actually owns the permission.

So there is no read-only switch, no policy file, no approval gate to configure. The one thing the tool guarantees is that nothing is silent: every call, over MCP and over the CLI alike, lands an audit row in ~/.firewall-aiops/audit.db, and reversible writes still capture their before-state and record an inverse where one exists.

Each tool declares a risk_level, matched to its [READ]/[WRITE] documentation tag, and carried into the audit row as a descriptive tier — so a reviewer can see at a glance that a row was a high-risk write. It is a label, not a gate.

Running a smaller / local model? See agent-guardrails.md — it lists the guardrails this tool now enforces for you (so you don't spend prompt budget restating them) and gives a ready-made system prompt for what's left.

Tool inventory (35 tools)

DomainTools#Kind
Systemfirmware_status, health_status, interface_status, gateway_status4read
Ruleslist_rules, rule_detail, rule_stats, rule_states4read
NATnat_port_forwards, nat_outbound, nat_one_to_one3read
Aliaseslist_aliases, alias_entries2read
VPNwireguard_status, openvpn_sessions, ipsec_sas3read
DHCPdhcp_leases, dhcp_static_mappings2read
Diagnosticsfirewall_log, states_table, top_talkers3read
Flagship analysesgateway_health_rca, rule_hit_and_shadow_analysis, blocked_traffic_rca3read
Writestoggle_rule, add_alias_entry, remove_alias_entry, kill_states, restart_service5write (med)
Writesapply_changes, reconfigure, reboot3write (high)
Undoundo_list, undo_apply2read / write

Reversible writes record an inverse undo descriptor built from the real fetched before-state (toggle_rule restores the rule's prior enabled flag; alias add/remove invert). apply_changes / reconfigure / reboot are high-risk with dry_run; reboot is irreversible (audit only).

Install

bash
uv tool install firewall-aiops        # or: pipx install firewall-aiops

Quick start

As a Claude Code plugin

One install gives an agent both the skill and the MCP server:

/plugin marketplace add AIops-tools/marketplace/plugin install firewall-aiops@aiops-tools

The MCP server is fetched with uv and pinned to the package version this plugin declares, so an audit row can be traced back to the code that wrote it. Credentials are still configured with firewall-aiops init — see below.

As an OpenClaw plugin

The same bundle is published on ClawHub, where one install delivers the skill and its MCP server together:

bash
openclaw plugins install clawhub:@zw008/firewall-aiopsopenclaw skills info firewall-aiops          # expect: Visible to model: yes

Restart the OpenClaw gateway afterwards so it loads the plugin. The MCP server is fetched with uv, pinned to this exact release, so uvx has to be on PATH — without it the skill still installs but reports Visible to model: no. Credentials are configured exactly as below.

As a CLI or standalone MCP server

bash
firewall-aiops init                     # wizard: pick platform (opnsense/pfsense) + store the secret (encrypted)firewall-aiops doctor                   # verify config, secrets, and connectivityfirewall-aiops overview                 # one-shot: version + gateway/interface health + rule countfirewall-aiops rules list               # list filter rulesfirewall-aiops rules toggle <uuid> --disable   # dry-run + double-confirm governed writefirewall-aiops log --action block -n 50 # recent blocked traffic

Run the MCP server (stdio) for an agent:

bash
firewall-aiops mcp                      # or: firewall-aiops-mcp

MCP client config

json
{  "mcpServers": {    "firewall-aiops": {      "command": "uvx",      "args": ["--from", "firewall-aiops", "firewall-aiops-mcp"],      "env": { "FIREWALL_AIOPS_MASTER_PASSWORD": "your-master-password" }    }  }}

Configuration

~/.firewall-aiops/config.yaml (non-secret connection details only):

yaml
targets:  - name: fw1    platform: opnsense       # opnsense | pfsense    host: 192.0.2.1    port: 443    username: <opnsense-api-key>   # OPNsense API key (unused for pfSense)    verify_ssl: true         # the default; false ONLY for self-signed lab certs  - name: edge    platform: pfsense    host: 192.0.2.2    verify_ssl: true    # scheme: http           # https is the default; http ONLY for a GUI behind a    #                        # proxy that terminates TLS for it

The secret — the OPNsense API secret (paired with the key for HTTP Basic auth) or the pfSense API key — is stored encrypted in ~/.firewall-aiops/secrets.enc (Fernet + scrypt-derived key), never plaintext on disk. Set it with firewall-aiops secret set <target> or the init wizard. The store is unlocked by a master password from FIREWALL_AIOPS_MASTER_PASSWORD (non-interactive/MCP/CI) or an interactive prompt (CLI on a TTY). A legacy plaintext env var FIREWALL_<TARGET>_SECRET is honoured as a fallback (migrate with firewall-aiops secret migrate).

Governance

Every MCP tool is wrapped by @governed_tool:

  • Audit — every call is logged to ~/.firewall-aiops/audit.db (tool, params with secrets redacted, status, duration, risk tier, approver, rationale).
  • Budget / runaway guard — per-process token/call caps and a repeat-call circuit breaker (FIREWALL_MAX_TOOL_CALLS, FIREWALL_RUNAWAY_MAX, …).
  • Risk-tier labelling — each tool's declared risk_level is recorded on its audit row as a descriptive tier (a label, not a gate); there is no read-only switch, policy file, or approval gate. FIREWALL_AUDIT_APPROVED_BY and FIREWALL_AUDIT_RATIONALE are optional audit annotations, recorded when set but never required.
  • Undo recording — reversible writes record an inverse descriptor to ~/.firewall-aiops/undo.db from the fetched before-state (recording only; an external orchestrator executes it).
  • Sanitisation — all firewall-returned text is bounded + injection-sanitised before it reaches the agent.

Platform support & verification status

  • Platforms: OPNsense (REST API) and pfSense (REST API v2, pfSense-pkg-RESTAPI).
  • Test coverage: behaviour is validated against mocked OPNsense/pfSense JSON responses — every module imports, every MCP tool carries the governance marker, the RCA heuristics are unit-tested against synthetic telemetry, and reversible writes are asserted to record the correct inverse undo descriptor. The concrete REST paths are modelled from each project's public API and have not yet been exercised against a live firewall. See docs/VERIFICATION.md for the checklist a live run must satisfy; firewall-aiops doctor (a firmware/version query on both platforms) is the fastest connectivity check. Both platforms are free and self-hostable (OPNsense is fully open-source; pfSense CE is free), so a home lab is the easiest place to run it.
  • Missing a capability? Open an issue or PR at github.com/AIops-tools/Firewall-AIops — contributions and feedback welcome.

License

MIT — see LICENSE.

來源:README.md,提交 59d07f7

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未能啟動。

版本歷史

5
  1. v0.16.0最新Oct 30, 2026
  2. v0.15.0Oct 15, 2026
  3. v0.13.0Oct 15, 2026
  4. v0.12.5Sep 17, 2026
  5. v0.12.4Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分