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

Aperta
#5,926 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
8/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
ollama, php, python
Ambito
devtools, security

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
PHP
Stelle
1.2k
Fork
932
Merge medio
1g 11h
PR unite (30g)
22

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opnsense/plugins

Tutte le issue di opnsense/plugins

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.