LabWired
회로 설계·펌웨어 실행·변형 비교·Playground 결과 확인, 오픈소스, 무료 체험
Generate meaningful output from your OPNsense/pfSense configuration file
README 전체를 불러오는 중입니다.
README 전문 보기 ↗opnDossier is a command-line tool for network operators and security professionals who work with OPNsense and pfSense firewalls. It turns XML config files into readable documentation and flags security issues, misconfigurations, and dead firewall rules.
It runs entirely offline, with no external dependencies and no telemetry, so it works in fully airgapped environments.
[!NOTE] pfSense support is strong for core firewall and service areas, but some report and audit sections are still in progress. If you work with pfSense, see the device support matrix for current feature-by-feature coverage. When a pfSense area is not yet supported, opnDossier warns during processing so you can tell the difference between a product gap and a missing configuration.
Download pre-built binaries for Linux, macOS, or Windows from releases, or install from source:
go install github.com/EvilBit-Labs/opnDossier@latest
go installnames the binaryopnDossierafter the module path. Every other install method ships it asopndossier, which is the name used throughout these examples — rename it, or install via Homebrew or a release archive.
# Generate configuration documentation
opndossier convert config.xml -o report.md
# Run security audit (blue mode is default)
opndossier audit config.xml
# Display config in terminal
opndossier display config.xml
opnDossier automatically analyzes your OPNsense or pfSense configuration to identify security issues, misconfigurations, and optimization opportunities.
Identifies common security issues in your firewall configuration:
Example output:
Automatically identifies firewall rules that will never be reached:
Example output:
DEAD RULES DETECTED:
- Rule #15: Rules after position 12 on interface lan are unreachable due to preceding block-all rule
- Rule #31: Rule at position 31 is duplicate of rule at position 28 on interface wan
Comprehensive checks for structural and logical issues:
Example validation report:
Finds enabled resources not actively used:
Built-in validation against security and operational best practices.
Download the latest release for your platform:
Extract and run:
tar -xzf opnDossier-*.tar.gz
./opndossier --help
Prerequisites: Go 1.26 or later
go install github.com/EvilBit-Labs/opnDossier@latest
git clone https://github.com/EvilBit-Labs/opnDossier.git
cd opnDossier
go build -o opndossier main.go
For development builds with additional tooling, see CONTRIBUTING.md.
If you plan to contribute, install the pre-commit and commit-msg git hooks so fast local checks run automatically:
just install # runs mise install, installs hook types, tidies modules
# or, manually:
mise exec -- pre-commit install --hook-type pre-commit --hook-type commit-msg
Run just ci-check manually before pushing for the full quality bar (lint, tests, race detector). See CONTRIBUTING.md §Development Setup for details.
# Run blue team defensive audit (default mode)
opndossier audit config.xml
# Blue team audit with specific compliance plugins
opndossier audit config.xml --plugins stig,sans
# Red team attack surface analysis
opndossier audit config.xml --mode red
# Export audit findings to JSON for automation/integration
opndossier audit -f json config.xml -o findings.json
# Convert OPNsense or pfSense config to markdown documentation
opndossier convert config.xml -o firewall-docs.md
# Generate YAML for configuration management tools
opndossier convert -f yaml config.xml -o config.yaml
# Display in terminal with custom wrap width
opndossier display --wrap 100 config.xml
# Validate configuration file
opndossier validate config.xml
# Validate before converting
opndossier validate config.xml && opndossier convert config.xml -o report.md
# Include system tunables in report
opndossier convert config.xml -o comprehensive.md --include-tunables
# Verbose output for troubleshooting
opndossier --verbose convert config.xml
# Quiet mode - only show errors
opndossier --quiet convert config.xml -o output.md
opnDossier can be configured via command-line flags, environment variables, or a configuration file.
| Setting | CLI Flag | Environment Variable | Config File | Description |
|---|---|---|---|---|
| Verbose logging | --verbose | OPNDOSSIER_VERBOSE | verbose: true | Enable debug/verbose output |
| Quiet mode | --quiet | OPNDOSSIER_QUIET | quiet: true | Suppress all non-error output |
| Input file | (positional) | OPNDOSSIER_INPUT_FILE | input_file: path | Default input configuration file |
| Output file | -o, --output | OPNDOSSIER_OUTPUT_FILE | output_file: path | Default output file path |
For a complete list of all configuration options, see the Configuration Reference.
Create ~/.opnDossier.yaml:
# Logging
verbose: false
quiet: false
# File paths
input_file: /path/to/default/config.xml
output_file: ./output.md
# Using CLI flags
opndossier --verbose convert config.xml
# Using environment variables
export OPNDOSSIER_VERBOSE=true
opndossier convert config.xml
# Using config file (automatically loaded from ~/.opnDossier.yaml)
opndossier convert config.xml
opnDossier supports multiple output formats for different use cases:
Specify format with -f or --format flag:
opndossier convert -f json config.xml -o output.json
opndossier convert -f yaml config.xml -o output.yaml
opndossier convert -f markdown config.xml -o output.md # default
opnDossier is available as a GitHub Action backed by its Docker image. Use it to audit or document OPNsense and pfSense configurations automatically on every commit, PR, or scheduled run.
name: Audit firewall configuration
on:
push:
paths:
- config.xml
schedule:
- cron: 0 6 * * 1 # every Monday at 06:00 UTC
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Audit OPNsense config
uses: EvilBit-Labs/[email protected]
with:
command: audit
config-file: config.xml
See Pinning for the recommended way to lock this reference in production CI.
| Input | Required | Default | Description |
|---|---|---|---|
command | No | audit | Sub-command: audit, convert, diff, display, sanitize, validate, or version |
config-file | Yes | — | Path to OPNsense or pfSense config.xml relative to the workspace root |
format | No | — | Output format for convert/audit: markdown, json, yaml, text, or html |
output | No | — | Path to write the output file, relative to the workspace root |
args | No | — | Additional arguments split on whitespace (quoted strings with spaces are not preserved) |
version | No | v1.9.0 | Image tag to pull (e.g. v1.9.0); defaults to the current release tag. latest is accepted but unpinned (see Pinning). |
- name: Export audit findings
uses: EvilBit-Labs/[email protected]
with:
command: audit
config-file: firewall/config.xml
format: json
output: findings.json
- name: Upload findings
uses: actions/upload-artifact@v4
with:
name: audit-findings
path: findings.json
- name: Generate firewall documentation
uses: EvilBit-Labs/[email protected]
with:
command: convert
config-file: config.xml
format: markdown
output: docs/firewall.md
GitHub Action references should be pinned with intention. The three options, in order of preference for production CI:
Recommended (production CI): pin to a full commit SHA. A SHA is immutable — tags can, in theory, be force-pushed; commit SHAs cannot. Include the matching version tag as a trailing comment so humans can still tell what they are running.
- name: Audit OPNsense config
# v1.9.0 — verify SHA against the release at https://github.com/EvilBit-Labs/opnDossier/releases/tag/v1.9.0
uses: EvilBit-Labs/opnDossier@20df9080af58530ce578c88b131678f6de5f0060
with:
command: audit
config-file: config.xml
Acceptable (most users): pin to a version tag. This is what the Quick Start snippet above uses. You trust that the maintainers will not move published tags (we don't), and in exchange you get a readable reference and automatic patch-level fixes when you bump.
- uses: EvilBit-Labs/[email protected]
Not recommended for production: @main or @latest. Both are moving targets: @main follows the default branch (may contain unreleased changes); @latest is only meaningful as an image tag on ghcr.io/evilbit-labs/opndossier and will pull whatever the registry currently points latest at. Use these only in throwaway sandboxes, never in CI that protects production configuration.
The version: input of the action follows the same three levels and defaults to the Action's own release tag: the v1.9.0 Action defaults to v1.9.0, and the SHA-pinned example above is the v1.9.0 Action and also defaults to v1.9.0. Override it only if you understand the tradeoff.
The Docker image is published to the GitHub Container Registry alongside every release and can be used independently of the Action:
# Pull the latest release
docker pull ghcr.io/evilbit-labs/opndossier:latest
# Run an audit, mounting your config directory
# WORKDIR is /data, so use relative paths after the volume mount
docker run --rm \
--volume "$(pwd):/data" \
ghcr.io/evilbit-labs/opndossier:latest \
audit config.xml
opnDossier's pkg/ packages are importable by other Go modules. The typical consumer flow is: parse an OPNsense or pfSense config.xml into a vendor-specific document, convert it to the platform-agnostic CommonDevice model, and work with that.
Module path: github.com/EvilBit-Labs/opnDossier
Go version: 1.26+ (opnDossier supports the current and previous stable Go releases — N and N-1 — matching Go's upstream policy).
See docs/development/public-api.md for the full public API classification, stability policy, and semver rules.
For consumers that already have a parsed schema document (for example, configuration generators that build one in-memory), call ConvertDocument directly. This is the idiomatic consumer entry point — no blank imports, no factory wiring. See docs/development/public-api.md § Idiomatic consumer entry point for the full contract.
package main
import (
"encoding/xml"
"fmt"
"os"
opnsenseparser "github.com/EvilBit-Labs/opnDossier/pkg/parser/opnsense"
opnschema "github.com/EvilBit-Labs/opnDossier/pkg/schema/opnsense"
)
func main() {
data, err := os.ReadFile("config.xml")
if err != nil {
panic(err)
}
var doc opnschema.OpnSenseDocument
if err := xml.Unmarshal(data, &doc); err != nil {
panic(err)
}
device, warnings, err := opnsenseparser.ConvertDocument(&doc)
if err != nil {
panic(err)
}
for _, w := range warnings {
fmt.Printf("[%s] %s: %s (value=%q)\n", w.Severity, w.Field, w.Message, w.Value)
}
fmt.Printf("device type: %s\n", device.DeviceType)
fmt.Printf("hostname: %s.%s\n", device.System.Hostname, device.System.Domain)
fmt.Printf("rules: %d\n", len(device.FirewallRules))
}
Use pkg/parser/pfsense and pkg/schema/pfsense for pfSense configurations.
When you have raw XML bytes of unknown provenance — a reader but no pre-parsed DTO — use pkg/parser.Factory. The factory is the auto-detection escape hatch: it peeks the XML root element and dispatches to the correct device parser. It is stable, but treat it as a convenience wrapper around ConvertDocument rather than the primary path. The factory requires two blank imports because device parsers self-register from their init() functions, and Go only runs init() for imported packages:
import (
"github.com/EvilBit-Labs/opnDossier/pkg/model"
"github.com/EvilBit-Labs/opnDossier/pkg/parser"
_ "github.com/EvilBit-Labs/opnDossier/pkg/parser/opnsense" // registers "opnsense"
_ "github.com/EvilBit-Labs/opnDossier/pkg/parser/pfsense" // registers "pfsense"
)
factory := parser.NewFactory(myXMLDecoder)
device, warnings, err := factory.CreateDevice(ctx, reader, model.DeviceTypeUnknown, false)
myXMLDecoder must satisfy parser.OPNsenseXMLDecoder. The interface is typed to *schema.OpnSenseDocument, so the OPNsense parser is the only bundled consumer — the pfSense parser accepts the decoder for signature compatibility but manages its own XML decoding. Consumers typically wrap encoding/xml themselves using parser.NewSecureXMLDecoder, which applies opnDossier's XML-bomb and XXE hardening. If no parser packages are imported, CreateDevice returns an error containing the substring "ensure parser packages are imported" — that hint is covered by a regression test and safe for tooling to match on.
ConversionWarningEvery converter returns a []model.ConversionWarning alongside the device. Warnings are non-fatal — they flag fields that did not round-trip perfectly (unrecognized enum values, truncated collections, orphan cross-references). Severity is a triage signal, not a compliance verdict:
| Severity | Meaning |
|---|---|
critical | Data loss or corruption in the converted output. |
high | Material gap or silently altered behavior. |
medium | Partial data preservation (e.g., truncated collections). |
low | Cosmetic or best-effort conversion gap. |
info | Normal observation about the conversion. |
Log all warnings; treat high and above as signals to investigate the source config before trusting the output.
CommonDeviceCommonDevice carries plaintext secrets sourced from the firewall configuration. If you serialize a CommonDevice to JSON, YAML, or any other format, these secrets will appear in cleartext unless you redact them yourself. opnDossier's CLI has redaction logic for its own convert and sanitize commands, but that code lives in internal/ and is not exposed as a public API.
The secret-bearing fields are:
| Struct | Field |
|---|---|
model.Certificate | PrivateKey |
model.CertificateAuthority | PrivateKey |
model.WireGuardClient | PSK |
model.APIKey | Secret |
model.HighAvailability | Password |
model.SNMPConfig | ROCommunity |
model.DHCPAdvancedV6 | AdvDHCP6KeyInfoStatementSecret |
model.InterfaceDHCPAdvancedV6 | AdvDHCP6KeyInfoStatementSecret |
If you add a new secret-bearing field to CommonDevice, update this table in the same PR.
Notes on fields that are not in this table:
CommonDevice — it can only leak via the raw-XML sanitize path (see internal/sanitizer rules, which the CLI applies). Library consumers that work exclusively with CommonDevice cannot accidentally emit OpenVPN TLS key material.model.IPsecConfig.KeyPairs and model.IPsecConfig.PreSharedKeys currently carry UUID references to the OPNsense Ipsec/KeyPairs and Ipsec/PreSharedKey MVC models, not raw key material. They are intentionally omitted from the table above. If a future OPNsense schema revision ever stores raw key bytes in these fields, they must be added here and to the CLI redaction logic in the same PR.IPsecPhase1.PreSharedKey (a scalar raw key on the pfSense XML schema) is intentionally not mapped into model.IPsecPhase1Tunnel; see pkg/parser/pfsense/converter_services.go and the TestConverter_IPsecPhase1_PreSharedKeyExclusion regression test.Recommended approaches, in order of preference:
opndossier convert --format json and opndossier sanitize apply the full redaction pipeline, including the field-pattern-based sanitizer. Safest for operators who need a hardened output.CommonDevice and set each secret field to "" (or a marker like "[REDACTED]") before passing it to json.Marshal or yaml.Marshal. Straightforward for known consumers that own the export path.json.Marshaler. Define a wrapper type that shallow-copies CommonDevice, zeros the secret fields on the copy, then delegates to json.Marshal. Useful when the export is deep inside a library you control.Do not rely on struct tags for redaction — json:"privateKey,omitempty" controls field names and omit-empty behavior, not whether the field is serialized at all.
If you add a new field to CommonDevice that carries a secret, update this table and update the CLI's redaction logic in the same change. See GOTCHAS § 13.1 for the testing pitfall with multiline secrets (JSON escapes newlines, so raw-string NotContains assertions pass vacuously — always unmarshal and assert on field values).
For developers:
opnDossier is designed with security as a first-class concern:
Dynamic compliance plugins are opt-in. The --plugin-dir flag on opndossier audit loads every .so file in the directory via Go's standard plugin.Open() mechanism; those plugins run with full opnDossier process privileges and are not signature-verified. Only point --plugin-dir at directories whose contents you build, review, and control — never at a world-writable path. A stderr warning is emitted whenever --plugin-dir is supplied. For the full threat model and hardening guidance, see audit command — Dynamic Plugin Security.
For security vulnerabilities, please see our security policy.
Apache License 2.0 - see LICENSE file for details.
See CONTRIBUTORS.md for the full list of contributors.
Built for network operators and security professionals.