FIREMAN (FIREwall Modelling and ANalysis)#

Fireman reads your firewall policies and points at the rules that don’t do what they seem to. It follows the FIREMAN paper: 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.

For each rule it can report:

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: 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 and is published on PyPI. To get the fireman command on its own, install it as a tool with uv or pipx:

uv tool 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

Working on Fireman itself? Clone the repository and run uv sync --all-groups.

Quickstart#

The docs use one small sample estate with one firewall and two policies, estate.yaml:

estate.yaml
# A small estate: one firewall, `edge`, between the internet, a DMZ and the LAN.
# The docs use it throughout. `inbound` is seeded with anomalies; `outbound` is
# clean.

addresses:
  - name: lan
    values: [10.1.0.0/16]
  - name: dmz
    values: [192.168.10.0/24]
  - name: web-servers
    values: [192.168.10.10, 192.168.10.11, 192.168.10.12]

fqdns:
  - name: update-server
    fqdn: updates.example.com
    addresses: [203.0.113.10]
    resolved_at: 2026-11-20T08:00:00Z
  - name: partner-api
    fqdn: api.partner.example
    addresses: [203.0.113.50]
    resolved_at: 2026-11-20T08:00:00Z

services:
  - name: web
    entries:
      - {protocol: 6, ports: [80, 80]}
      - {protocol: 6, ports: [443, 443]}
  - name: ssh
    entries:
      - {protocol: 6, ports: [22, 22]}
  - name: dns
    entries:
      - {protocol: 17, ports: [53, 53]}
      - {protocol: 6, ports: [53, 53]}

groups:
  # Every DMZ host except the web servers. A global group sees the global
  # `web-servers`, even inside `edge`, which has its own.
  - name: dmz-hosts
    kind: address
    include: [dmz]
    exclude: [web-servers]

firewalls:
  - name: edge
    addresses:
      # edge publishes only two of the three web servers.
      - name: web-servers
        values: [192.168.10.10, 192.168.10.11]
    policies:
      - name: inbound
        rules:
          - order_id: 10
            name: block-abusers
            action: deny
            sources: [198.51.100.0/24]
            destinations: [web-servers]
            services: [web]
          - order_id: 20
            name: allow-web
            action: accept
            sources: [any]
            destinations: [web-servers]
            services: [web]
          - order_id: 30
            name: allow-partner-https
            action: accept
            sources: [203.0.113.0/24]
            destinations: [web-servers]
            services:
              - {protocol: 6, ports: [443, 443]}
          - order_id: 40
            name: block-scanners
            action: deny
            sources: [192.0.2.0/24]
            destinations: [web-servers]
            services: [web]
          - order_id: 50
            name: allow-partner-api
            action: accept
            sources: [partner-api]
            destinations: [web-servers]
            services: [web]
          - order_id: 60
            name: allow-admin-ssh
            action: accept
            sources: [lan]
            destinations: [dmz-hosts]
            services: [ssh]
      - name: outbound
        rules:
          - order_id: 10
            name: allow-dns
            action: accept
            sources: [lan]
            destinations: [any]
            services: [dns]
          - order_id: 20
            name: allow-updates
            action: accept
            sources: [dmz-hosts]
            destinations: [update-server]
            services: [web]
          - order_id: 30
            name: allow-web-out
            action: accept
            sources: [lan]
            destinations: [lan, dmz]
            destination_negate: true
            services: [web]
          - order_id: 40
            name: allow-ping
            action: accept
            sources: [lan]
            destinations: [any]
            services:
              - {protocol: 1, icmp_type: 8}

Fetch it, load it, then classify it:

curl -fO 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)     │
└──────────┴─────────┴───────────────────────────────────┴────────────────┴─────────────────────────────┘
0 of 1 firewall from cache

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. The last line goes to stderr: how many firewalls classify took from its cache.

Where to go next#

Concepts

How Fireman walks a policy, what each anomaly means exactly, and how names and workspaces work. Read this first.

Input format

Every field of the YAML and JSON input, and the errors you get when something is off.

Command line

Running the commands and reading their output.

Python API

Using Fireman from Python scripts.

Extending

Reading your own formats (CSV, XML, a vendor export) by writing a source.