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

Abierto
#5,926 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
8/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
ollama, php, python

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
PHP
Estrellas
1.2k
Forks
932
Merge medio
1 d 11 h
PR fusionados (30 d)
22

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de opnsense/plugins

Todos los issues de opnsense/plugins

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.