Skip to main content

Fireman

Static analysis for firewall policies: audit rules written in YAML, from the command line or Python. Built on the FIREMAN paper.

Fireman reads your firewall policies and points at the rules that don't do what they seem to. Each policy is walked in order with every rule turned into an exact set of packets, so overlaps between address ranges, groups, port ranges and negated fields are worked out, never guessed.

Find shadowed and redundant firewall rules

  • Shadowed: the rule never fires, and earlier rules give some of its traffic the other action. Usually a mistake.
  • Redundant: removing the rule changes nothing, because earlier rules already give its traffic the same action, or later rules would once it is gone.
  • Correlated: the rule overlaps an earlier rule with the other action, so their order decides what the overlap gets.
  • Generalization: the rule also contains the whole of that earlier rule, a narrow exception before a broad rule. Often intended, worth a look.
  • Empty: the rule matches no traffic, for example through a group that excludes everything it includes.

It also answers the everyday questions: is this traffic already allowed (fireman covered), where would a new rule go (fireman place), and what uses this object (fireman usage).

Install

Fireman needs Python 3.12 or newer. For the fireman command, install it as a tool:

uv tool install fireman     # or: pipx install fireman
fireman --help

To use it from your own Python code, add it to your project instead:

uv add fireman              # or: pip install fireman

Quickstart

Download the sample estate (one firewall, two policies), load it, then classify it:

curl -O https://raw.githubusercontent.com/HorusTheSonOfOsiris/fireman/main/docs/examples/estate.yaml
fireman load estate.yaml
fireman classify
Loaded workspace 'default': 1 firewalls, 2 policies, 10 rules, 10 objects.
                                                Findings
┏━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Firewall ┃ Policy  ┃ Rule                              ┃ Anomaly        ┃ Related                     ┃
┡━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ edge     │ inbound │ allow-web (order_id 20)           │ generalization │ block-abusers (order_id 10) │
├──────────┼─────────┼───────────────────────────────────┼────────────────┼─────────────────────────────┤
│ edge     │ inbound │ allow-web (order_id 20)           │ correlated     │ block-abusers (order_id 10) │
├──────────┼─────────┼───────────────────────────────────┼────────────────┼─────────────────────────────┤
│ edge     │ inbound │ allow-partner-https (order_id 30) │ redundant      │ allow-web (order_id 20)     │
├──────────┼─────────┼───────────────────────────────────┼────────────────┼─────────────────────────────┤
│ edge     │ inbound │ block-scanners (order_id 40)      │ shadowed       │ allow-web (order_id 20)     │
├──────────┼─────────┼───────────────────────────────────┼────────────────┼─────────────────────────────┤
│ edge     │ inbound │ allow-partner-api (order_id 50)   │ redundant      │ allow-web (order_id 20)     │
└──────────┴─────────┴───────────────────────────────────┴────────────────┴─────────────────────────────┘

load validates the file and keeps it as a workspace in .fireman/ in the current directory. Every other command reads from there, so you load once and ask many questions. The outbound policy is clean, so it has no rows.

Audit firewall policies in Python

The same models back the files, so you can build a policy in code, compile it and classify it:

import click

from fireman import BDDManager, compile_inventory
from fireman.model import Firewall, Inventory, Policy, Rule

https = {"protocol": 6, "ports": [443, 443]}
rules = [
    Rule(
        order_id=10,
        name="allow-lan",
        action="accept",
        sources=["10.0.0.0/8"],
        destinations=["any"],
        services=[https],
    ),
    Rule(
        order_id=20,
        name="block-guests",
        action="deny",
        sources=["10.9.0.0/16"],
        destinations=["any"],
        services=[https],
    ),
]
policy = Policy(name="outbound", rules=rules)
inventory = Inventory(firewalls=[Firewall(name="edge", policies=[policy])])

compiled = compile_inventory(inventory, BDDManager(nodes=1 << 20, cache=1 << 18, threads=1))
for finding in compiled.policies["edge", "outbound"].classify():
    click.echo(f"{finding.rule.name} {finding.anomaly} {[r.name for r in finding.related]}")
block-guests shadowed ['allow-lan']

To read files instead, fireman.Pipeline().load(fireman.yaml_file(path)) gives the same Inventory.

License

Fireman is licensed under the GNU Affero General Public License v3.0. See LICENSE.

Metadata

Release files for fireman 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fireman 0.4.0
File Size Uploaded Provenance Actions
fireman-0.4.0.tar.gz 85.9 kB With provenance Details for fireman-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fireman 0.4.0
File Interpreter ABI Platform Actions
fireman-0.4.0-py3-none-any.whl Python 3 none any Details for fireman-0.4.0-py3-none-any.whl

Total release size: 192.9 kB

Release files / fireman-0.4.0.tar.gz

Download URL fireman-0.4.0.tar.gz
Size 85.9 kB
Tags Source
SHA-256 checksum
How to use checksums
275b7e7d93371b7c8f213997ad3290ed9b02052c61f824a55ed468ddb621d26b
BLAKE2b-256 checksum
How to use checksums
c527d7eac8bb295495156b9f78d3d045ed867b8ebb5bb106b38eef01268271f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / fireman-0.4.0-py3-none-any.whl

Download URL fireman-0.4.0-py3-none-any.whl
Size 107.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55f90577adc90ff6388ce816445acd85a38509e14251a69fe983caed38e2ccc0
BLAKE2b-256 checksum
How to use checksums
438fae3dab88cd3a0613b4bb20bbdfa45a09ff5a8753a6376d9cedac5d2ee1f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for fireman 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fireman-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page