sanitize
opnDossier sanitize¶
Redact sensitive data from OPNsense configuration files.
Synopsis¶
The 'sanitize' command redacts sensitive information from OPNsense configuration files, making them safe to share for troubleshooting, documentation, or public reporting without exposing credentials, IP addresses, or other sensitive data. Unlike --redact on other commands (which only affects the rendered output), sanitize rewrites the source config.xml itself.
SANITIZATION MODES: Choose the mode with --mode/-m based on your sharing context:
aggressive - Maximum redaction for public sharing (forums, GitHub issues).
Redacts passwords, keys, certificates, all IPs, MACs, emails,
hostnames, usernames, domains, OTP seeds, WireGuard endpoints,
tunnel addresses, subnets, Cloudflare IDs, public keys.
moderate - Balanced redaction for internal sharing (default).
Redacts passwords, keys, authserver values, public IPs, MACs,
emails. Preserves private IPs and hostnames for topology analysis.
minimal - Credentials + authserver redaction for trusted environments.
Redacts passwords, secrets, API keys, PSKs, private keys, SSH
keys, and authserver values. Preserves all network information.
REFERENTIAL INTEGRITY: The sanitizer keeps consistent mappings inside a single run: - The same original value is always replaced with the same redacted value. - Network relationships remain visible (e.g. 192.168.1.1 -> 10.0.0.1). Use --mapping to write a JSON reverse-lookup table alongside the output.
OUTPUT: By default, sanitized XML is printed to stdout. Use --output/-o to save to a file, and --force to overwrite an existing file. Sanitize never modifies the input in place.
RELATED: convert - Use --redact for single-pass redaction of the rendered report audit - Use --redact to keep audit output safe to share
Examples¶
# Sanitize for public sharing (maximum redaction)
opnDossier sanitize config.xml --mode aggressive -o config-sanitized.xml
# Sanitize for internal sharing (default mode)
opnDossier sanitize config.xml -o sanitized.xml
# Sanitize with mapping file for reverse lookup
opnDossier sanitize config.xml -o sanitized.xml --mapping mappings.json
# Minimal redaction (credentials and authserver values only)
opnDossier sanitize config.xml --mode minimal
# Force overwrite of an existing file
opnDossier sanitize config.xml -o output.xml --force
# Pipe to another command
opnDossier sanitize config.xml | less
Options¶
-m, --mode string Sanitization mode: aggressive (public sharing), moderate (internal sharing), minimal (credentials + authserver values) (default "moderate")
-o, --output string Output file path for sanitized configuration (default: print to console)
--mapping string Output path for mapping file (JSON) that documents original→redacted mappings
--force Force overwrite existing files without prompting for confirmation
-h, --help help for sanitize
Options inherited from parent commands¶
--color string Color output mode (auto, always, never) (default "auto")
--config string Configuration file path (default: $HOME/.opnDossier.yaml)
--debug Enable debug-level logging (all messages, for troubleshooting)
--device-type string Force device type (supported: opnsense, pfsense). Bypasses auto-detection.
--minimal Minimal output mode (suppresses progress and verbose messages)
--no-progress Disable progress indicators
-q, --quiet Suppress all output except errors and critical messages
--timestamps Include timestamps in log output
-v, --verbose Enable info-level logging (warnings, errors, and informational messages)
SEE ALSO¶
- opnDossier - opnDossier: A CLI tool for processing OPNsense and pfSense configuration files.