security/policyanalyzer: new plugin, read-only firewall policy analysis with optional local AI

オープン
#5,926 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
8/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
ollama, php, python
領域
devtools, security

調査の方向性

This is a proposal for a large third-party plugin, not a scoped change to the repository, and the maintainers have not yet answered whether any part should be accepted. Read the linked repository igortoledo007/opnsense-policyanalyzer and the maintainer questions about a small first plugin and translation domains. Done means a maintainer decision on scope and packaging, not a code change.

索引モデルが issue の本文から書いたものです。

説明

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

Hi, before going any further I'd like your feedback on a larger plugin. Our community is crucial in shaping the ongoing development of our open-source OPNsense® software products.

A firewall rule set grows over the years and it becomes hard to tell which rules still matter, which ones are shadowed or too broad, what is actually exposed, and what the blocked traffic means. The data is all in OPNsense (rules and counters, the filter log, Suricata, Unbound, Kea), but there is no place that puts it together and explains it.

Describe the solution you'd like

What it is

Policy Analyzer (branded "Max Cyber IA" in the GUI) is a plugin under Firewall › Policy Analyzer. Source, install guide and tests: https://github.com/igortoledo007/opnsense-policyanalyzer

Page What you get
Analysis findings on the rule set: shadowed, redundant, unused or too broad rules, risky exposures, with evidence and a suggested fix
Incidents blocked and suspicious traffic grouped into scored incidents with a timeline
Anomalies beaconing, DNS tunnels and bypass, new domains and devices, outbound volume, internal scans
Posture hardening checks of the firewall itself, with a score per category
Devices passive inventory of local devices (DHCP, ARP/NDP, flows), vendor and risk hints
Vulnerabilities exposed services matched against CVE data (NVD, CISA KEV, EPSS, OSV), opt-in
AI Console questions in plain language, answered from read-only evidence
Reports daily/weekly PDF reports and alerts by e-mail

Design rules:

  • Read only by default. The analysis never changes rules. The only optional action is a quarantine (an External alias + one floating block rule), and every change follows simulate → apply → revert with an action history.
  • AI is optional and can stay local. An assistant installs Ollama in a FreeBSD jail without Internet access; a server in the LAN or the Anthropic API can be used instead. Data is anonymized before it goes to a remote provider.
  • Uses what OPNsense already has: rules and counters, the filter log, Suricata eve.json, Unbound reporting, Kea, Insight/NetFlow, Monit's SMTP settings and the GeoIP aliases (the user's own MaxMind key; no GeoIP data is shipped).
  • Python standard library only, no extra packages. About 950 unit tests run without a firewall on synthetic data.
  • Languages: the GUI and the PDF/e-mail reports are available in the 20 OPNsense languages. The GUI uses its own gettext domain (PolicyAnalyzer) with the core catalogue as fallback, so the core catalogue is never touched and strings the core already translates keep the core translation. PDFs embed the default theme font for Latin, Greek and Cyrillic scripts; Chinese, Japanese, Korean and Persian PDFs fall back to English (OPNsense ships no font for them) while the e-mail keeps the language. The translations were made with AI assistance and reviewed; corrections from native speakers are welcome.
Questions
  1. The code base is large (Python ~55k lines, plus GUI). I know big initial code bases can't be reviewed. Would a small first plugin make sense, for example only the read-only rule analysis (Analysis page, no AI, no quarantine), with the rest staying in my repository or coming later in parts?
  2. Or is it better kept as a third-party plugin in its own repository? In that case, is there a recommended way to make it discoverable to users?
  3. For translations of a plugin outside the official repository: is a separate gettext domain the right approach, or is there a way to contribute the strings to opnsense/lang?

I'm happy to maintain whatever part is accepted. Maintainer: igortoledo007 (please reach me here on GitHub).

Describe alternatives you've considered

  • Separate tools outside the firewall (log shippers, SIEM): heavier, and the rule analysis needs the live configuration and counters.
  • Proposing parts to core: the analysis is optional and opinionated, so a plugin keeps it out of the way of users who don't want it.

Additional context

AI disclosure

Developed with AI assistance: Claude (Anthropic), a mix of the Fable 5.2 and Opus 5.5 models. I reviewed and tested it on my own OPNsense 26.7.9 firewall.

Screenshots

Taken on my own firewall running OPNsense 26.7.9 (Forja theme from #5921); addresses, host and device names are blurred.

  1. Analysis
  2. Incidents
  3. Anomalies
  4. Posture
  5. Devices
  6. AI Console
  7. AI setup
01-analysis 02-incidents 03-anomalies 04-posture 05-devices 06-ai-console 07-ai-setup
主要言語
PHP
スター
1.2k
フォーク
932
平均マージ
1日 11時間
マージ済み PR(30日)
22

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

opnsense/plugins のほかの issue

opnsense/plugins の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。