Architecture -- Load references/architecture.md for HardenedBSD, MVC/API, Suricata, FRR, plugins
関連 Skill
API automation -- REST API with key/secret authentication, JSON format
Dynamic routing -- FRR plugin for BGP, OSPF, BFD
Identify version -- Determine OPNsense version (26.1 "Witty Woodpecker" is current). Version matters: Suricata v8 inline requires 26.1+, full firewall MVC/API requires 26.1+.
Load context -- Read the reference file for deep knowledge.
Analyze -- Apply OPNsense-specific reasoning. OPNsense is API-first and differs significantly from pfSense in architecture despite shared FreeBSD heritage.
Recommend -- Provide guidance with GUI paths, API endpoints, and CLI commands.
Verify -- Suggest validation via API queries, Suricata EVE logs, pfctl commands, Unbound diagnostics.
API key + API secret generated per user in System > Access > Users.
Example Calls
# List firewall aliases
curl -u "$KEY:$SECRET" https://fw.example.com/api/firewall/alias/searchItem
# Add a firewall rule
curl -X POST -u "$KEY:$SECRET" \
-H "Content-Type: application/json" \
-d '{"rule":{"type":"pass","interface":"lan","protocol":"tcp","source":{"net":"10.0.0.0/8"},"destination":{"net":"any"},"destination_port":"443"}}' \
https://fw.example.com/api/firewall/filter/addRule
# Apply pending changes
curl -X POST -u "$KEY:$SECRET" \
https://fw.example.com/api/firewall/filter/apply
# Suricata status
curl -u "$KEY:$SECRET" https://fw.example.com/api/ids/service/status
API Design
RESTful: GET (read), POST (create/action), PUT (update), DELETE (remove)
JSON response format
Versioned and documented
Nearly complete coverage of all configuration domains
Diagnostics
# pf rules
pfctl -sr # Show active rules
pfctl -ss # Show state table
pfctl -si # Show pf statistics
# Suricata
suricatasc -c "iface-stat" # Suricata interface stats
cat /var/log/suricata/eve.json | jq # EVE JSON log
# Unbound
unbound-control stats_noreset # DNS resolver statistics
unbound-control dump_cache # DNS cache dump
# System
top -SH # Process CPU/memory
netstat -rn # Routing table
ifconfig -a # Interface status
Common Pitfalls
API key permissions -- API keys inherit the user's group permissions. Ensure the user has appropriate privilege set for the API operations needed.
Suricata inline vs IDS mode -- Inline (divert) mode blocks traffic matching drop rules. If Suricata causes connectivity issues, switch to IDS mode for tuning, then re-enable inline.
FRR and firewall interaction -- FRR-learned routes are added to the kernel routing table but firewall rules still evaluate on pf. Ensure rules permit traffic for dynamically learned routes.
Plugin version compatibility -- Plugins are version-tied. After major OPNsense upgrade, verify all plugins are compatible and updated.
Unbound DNSSEC failures -- DNSSEC validation can break resolution for misconfigured domains. Add problem domains to DNSSEC exclusion list rather than disabling DNSSEC globally.
CARP without dedicated sync -- Same as pfSense: pfsync over production interfaces risks state corruption. Use dedicated link.
Zenarmor licensing -- Free tier has limited features. Pro license required for advanced web filtering categories and full reporting.
Config.xml direct editing -- OPNsense stores all config in XML. Direct editing is possible but risky; use the API instead. Always back up before manual XML changes.
Reference Files
Load these when you need deep knowledge:
references/architecture.md -- HardenedBSD, MVC/API internals, Suricata v8, FRR, plugins, Zenarmor. Read for "how does X work" questions.