Bastion
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
- Phase 1 — Configuration Collection
- Phase 2 — Rule Engine Evaluation
- Phase 3 — Compliance Scoring
- 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
Intelligence
Output
Parsing
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
Audit a Cisco ASA configuration export.
Audit 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
| File | Format | Description |
|---|---|---|
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
| Method | Usage |
|---|---|
| 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
- Crucible (manages)
- Prometheus (reports)
Third-Party Dependencies & Credits
| Tool / Library | Developer | Type | Link |
|---|---|---|---|
| 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
| Name | Bastion |
| Category | Analysis |
| Version | 2.3.1 |
| Install Path | /opt/pr0t31n/Bastion |
| Main File | bastion.py |
| GitHub | https://github.com/pr0t31n/Bastion.git |