pfjson A CLI tool to convert OpenBSD Packet Filter configuration files ( pf.conf ) to JSON and vice versa. Features Bidirectional conversion between pf.conf and JSON formats Preserves comments and formatting Checksum verification using SHA256 and SHA512 for data integrity File metadata tracking including original filename and file size File overwrite protection requiring explicit force flag ("-f") Stdin/stdout support using "-" as filename Syntax validation and dry-run modes Full parsing of all pf.conf elements: Macros and variables Tables with IP/hostname entries Filter rules (pass/block) NAT and RDR rules Scrub rules Options and settings (standalone and inline) Installation # Compile from source v . Quick Start # Convert your pf.conf to JSON (backup) pfjson -e /etc/pf.conf backup.json # Restore from JSON backup pfjson -d backup.json restored.conf # Validate your pf.conf syntax pfjson -c -e /etc/pf.conf Usage Help $ pfjson -h pfjson v0.9.0 ----------------------------------------------- Usage: pfjson [options] [ARGS] Description: CLI tool to convert pf.conf to JSON and vice versa Options: -e, --encode Encode pf.conf to JSON -d, --decode Decode JSON to pf.conf -c, --check Syntax check only -n, --dry-run Dry run mode -v, --verify Strict checksum verification (fail on mismatch) -f, --force Force overwrite existing output files -j, --json Machine-parsable JSON output -h, --help display this help and exit --version output version information and exit Encoding (pf.conf → JSON) Convert a pf.conf file to JSON format: # Output to stdout $ pfjson -e pf.conf # Output to file $ pfjson -e pf.conf output.json # Read from stdin (use "-" as filename) $ cat pf.conf | pfjson -e - $ echo ' ext_if = "em0" ' | pfjson -e - # Syntax check only (no output) $ pfjson -c -e pf.conf # Dry run (show what would be output) $ pfjson -n -e pf.conf Example pf.conf: # External interface ext_if = " em0 " # Web server web_server = " 192.168.1.10 " # Blocked IPs table table < blocklist > { 10.0.0.1, 1...
First seen: 2025-10-06 14:06
Last seen: 2025-10-06 19:06