Bastion

Analysis v2.3.1 — Firewall configuration audit — parses vendor configs for policy violations, shadowed rules, and compliance gaps.
3
Dependencies
4
Phases
60
Catalogue Findings
BA
Finding Prefix

How It Works

🛡️ Sensitive Data Handling

This tool collects, processes, or stores data that may include sensitive, personally identifiable, or client-proprietary information — even when sourced from public repositories or non-client-controlled systems. Handle all collected data in accordance with your engagement’s data handling agreement, applicable privacy regulations (GDPR, CCPA, HIPAA), and your organization’s data classification policy. Store findings in encrypted, access-controlled locations and destroy data per the agreed retention schedule.

Bastion is a pure-CLI firewall configuration audit tool that analyses exported firewall rulesets to identify security weaknesses, overly permissive rules, and compliance gaps. It accepts a directory of firewall configuration files or a single configuration file and applies a vendor-specific parser followed by a universal audit engine to produce structured findings.

The audit pipeline consists of two stages. First, the engine/parsers/ module auto-detects the firewall vendor (Cisco ASA, Palo Alto, Fortinet, pfSense, iptables, etc.) using signature-based detection and parses the configuration into a normalised ParseResult data structure. Second, the engine/audit_engine.py evaluates this parsed configuration against a library of security audit rules defined in audit_rules.yaml, checking for overly broad allow rules, missing deny-all defaults, insecure protocols, unused objects, shadowed rules, and compliance violations.

Bastion enriches its findings with threat intelligence: IP addresses and URLs referenced in firewall rules are checked against curated blocklists, and GeoIP country mapping identifies rules that permit traffic to or from high-risk jurisdictions. Output conforms to the universal pr0t31n schema (meta.json, findings.json, summary.json) with UPPERCASE risk values. When run under Crucible (CRUCIBLE_MANAGED=1), Bastion emits structured protocol tokens for real-time status and finding delivery.

Phase Pipeline

  1. Phase 1 — Configuration Collection
  2. Phase 2 — Rule Engine Evaluation
  3. Phase 3 — Compliance Scoring
  4. Phase 4 — Findings Generation

Security

CLI tool. Processes firewall configuration exports locally — no network access required during analysis. Input files should be stored with restricted permissions.

Features

Audit

Rule Security Analysis
Evaluates firewall rules for overly broad permits (any-any), missing deny-all defaults, insecure protocol allowances, and unused ACL objects.
Shadowed Rule Detection
Identifies rules that are completely shadowed by earlier, more permissive rules and will therefore never match traffic.
Compliance Checks
Evaluates firewall configuration against security compliance frameworks (PCI DSS, CIS, NIST 800-53) for configuration gaps.

Intelligence

Threat Intel IP/URL Reputation
Checks IP addresses and URLs referenced in firewall rules against curated blocklists for known-malicious indicators.
GeoIP Country Mapping
Maps IP addresses in firewall rules to geographic locations, flagging rules that permit traffic to or from high-risk countries.

Output

Universal Schema Output
Produces meta.json, findings.json, and summary.json conforming to the pr0t31n universal output schema with relative evidence paths.

Parsing

Multi-Vendor Support
Auto-detects and parses firewall configurations from Cisco ASA, Palo Alto, Fortinet, pfSense, iptables, and other vendors via extensible parser modules.
Vendor Auto-Detection
Signature-based detection automatically identifies the firewall vendor from the configuration file content, requiring no manual specification.

Use Cases

Firewall Rule Review

Systematic review of firewall rulesets as part of a network security assessment, identifying overly permissive rules, unused objects, and configuration drift from security baselines.

PCI DSS Firewall Compliance

Evaluate firewall configurations against PCI DSS requirements for network segmentation, deny-all default rules, and documented business justification for permitted traffic.

Network Segmentation Validation

Verify that firewall rules enforce the intended network segmentation design, ensuring that restricted zones (e.g., medical device networks, cardholder data environments) are properly isolated.

Firewall Migration Audit

Compare firewall configurations before and after a migration or change window to verify that the security posture was maintained and no unintended rules were introduced.

CLI Reference

Command Examples

Audit Cisco ASA

python3 bastion.py --config-dir /path/to/configs --output-dir /path/to/output --vendor cisco_asa

Audit a Cisco ASA configuration export.

Audit Palo Alto

python3 bastion.py --config-dir /path/to/configs --output-dir /path/to/output --vendor palo_alto

Audit a Palo Alto configuration export.

Finding Nomenclature

Bastion findings are generated by the audit engine against parsed firewall rules. Each finding references the specific rule or configuration line that triggered the detection, including the source/destination networks, service ports, and action (permit/deny). Risk levels range from CRITICAL (any-any permit with no logging) through INFO (informational configuration observations). Findings include the vendor-specific rule identifier and line number for precise remediation targeting. Threat-intel enriched findings include the blocklist source and GeoIP country for flagged IP addresses.

Action Items

Bastion generates action items for rules requiring manual review — e.g., "Review any-any rule on interface Outside", "Verify business justification for inbound RDP from 0.0.0.0/0", "Confirm shadowed rule is intentional".

Output Files

FileFormatDescription
meta.json JSON Tool identity and engagement metadata
findings.json JSON Universal findings array v1.1
findings.csv CSV CSV mirror of findings
summary.json JSON Aggregated statistics
scan.log TXT Human-readable timestamped log
scan.log.json JSONL Machine-readable JSON log events
errors.log TXT ERROR-level entries only

Invocation Methods

MethodUsage
CLI — Direct cd /opt/pr0t31n/Bastion && python3 bastion.py [OPTIONS]

Run directly with command-line arguments.

Crucible-Managed

Launched and managed by Crucible (port 5100). Crucible handles start/stop/pause, log streaming, findings aggregation, and status tracking.

Integration

Used By

Third-Party Dependencies & Credits

Tool / LibraryDeveloperTypeLink
networkx Aric Hagberg / Dan Schult / Pieter Swart python https://github.com/networkx/networkx
matplotlib John Hunter / Matplotlib contributors python https://github.com/matplotlib/matplotlib
lxml lxml project / Stefan Behnel python https://github.com/lxml/lxml

Metadata

NameBastion
CategoryAnalysis
Version2.3.1
Install Path/opt/pr0t31n/Bastion
Main Filebastion.py
GitHubhttps://github.com/pr0t31n/Bastion.git