Command line#

The fireman command works in two steps: fireman load reads your files once, and every other command asks questions of what it stored. The pages in this part use the sample estate, estate.yaml, and assume it is in the current directory:

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}
fireman load estate.yaml                               # validate and store
fireman classify                                       # find anomalies
fireman usage web-servers --firewall edge              # what uses a name
fireman place --firewall edge --policy inbound \
  --action accept --src lan --dst dmz --tcp 8080       # where would a rule go
fireman covered --firewall edge --policy inbound \
  --action accept --src lan --dst dmz-hosts --service ssh   # is it allowed already
fireman load

Validate YAML, JSON or your own sources and store them as a workspace.

fireman classify

Report shadowed, redundant, correlated, generalization and empty rules.

fireman place

Show where a new rule would go, or which rule to widen.

fireman covered

Check whether a policy already gives some traffic the action you want.

fireman usage

List the groups and rules that use a name, directly or through groups.

fireman cache

Delete stored workspaces and cached findings.

Workspaces#

fireman load stores the validated estate as a named workspace in .fireman/fireman.db, under the directory you run it from. Run every command from that same directory. The name is default unless you pass --name, and every command takes --name to pick one:

fireman load estate.yaml --name lab
fireman classify --name lab

Loading a name again replaces it. A failed load stores nothing and leaves the old workspace as it was. Names follow the same rule as object names: no leading or trailing whitespace.

The other commands never read your files again. If a file you loaded changes, disappears or can’t be read, they print a warning on stderr, then carry on with the stored copy:

warning: sources changed since load; run `fireman load`
  /home/me/fw/estate.yaml

Run fireman load again to pick up the change.

How load and classify fit together#

classify keeps a findings cache next to the workspaces, keyed by a digest of each firewall (see Concepts). Only firewalls whose digest is not cached are compiled, one at a time, each in a fresh BDD manager.

        sequenceDiagram
    actor You
    participant CLI as fireman
    participant Pipeline
    participant Store as Store (.fireman/fireman.db)

    You->>CLI: fireman load estate.yaml
    CLI->>CLI: file_source(estate.yaml)
    CLI->>Pipeline: load(source)
    Pipeline-->>CLI: Inventory (or LoadError, exit 1)
    CLI->>Store: save_workspace("default", inventory, files)
    CLI-->>You: Loaded workspace 'default': ...

    You->>CLI: fireman classify
    CLI->>Store: open_workspace("default")
    Store-->>CLI: Inventory (+ stale-file warning)
    CLI->>Pipeline: classify(inventory, make_bdd, store)
    loop each firewall
        Pipeline->>Store: digest(firewall), findings(digest)
        alt cached
            Store-->>Pipeline: findings
        else not cached
            Pipeline->>Pipeline: compile in a fresh BDD, classify
        end
    end
    Pipeline->>Store: save(new findings)
    Pipeline-->>CLI: findings per policy
    CLI-->>You: table, JSON or YAML
    

Global options#

These go before the command name, e.g. fireman --bdd-nodes 268435456 classify.

Option

Meaning

Default

--bdd-nodes

Most BDD nodes one manager may hold

67108864

--bdd-cache

Size of the BDD operation cache

1048576

--version

Print the version and exit

--help

Show help; works on every command too

The node ceiling is not allocated up front, so the default is cheap. You only need to raise it for very large estates. When a firewall needs more, the command stops with a hint and exits 1:

Error: BDD ran out of nodes (100); raise --bdd-nodes, e.g. fireman --bdd-nodes 400 ...

A bigger --bdd-cache can speed up large runs at the cost of memory.

Output formats#

classify, place, covered and usage take --format table|json|yaml. The default table is for reading. JSON and YAML carry the same data for scripts, plus the traffic of each decision in full. Tables follow the terminal width and wrap or shorten long cells (with …) when it is narrow.

Rule labels#

Tables show a rule by its name when it has one, and always keep its order_id:

Named rule

allow-web (order_id 20)

Unnamed rule

order_id 20

Implicit deny

implicit deny, the final deny-all rule Fireman adds to every policy.

Undecided

undecided, traffic no rule decides (only with --no-implicit-deny).

The order_id stays next to the name because names are optional and only unique within a policy, while every rule has an order_id. It is also the number you look up on the firewall. JSON and YAML carry both as separate fields, with name: null for an unnamed rule:

rule:
  order_id: 20
  name: allow-web

Exit codes#

Code

Meaning

0

Success. For covered: every request is covered.

1

load found problems in the input (nothing stored); a load --source module or function raised (Error: --source SPEC: Type: message); a file load watches can’t be read when it stores the workspace (Error: cannot read recorded file 'PATH': reason, nothing stored); the BDD ran out of nodes; covered: at least one request is not covered; a cache clear prompt was answered no.

2

Usage error: a bad option or value, no workspace (run fireman load), an unknown firewall, policy or name, or a bad request for place or covered.

Errors go to stderr, results to stdout.