fireman load#
load reads your estate, checks all of it, and stores it as a workspace that
every other command reads. It is the only command that takes input files, so you
run it once, and again whenever the files change. If anything is wrong it lists
every problem, exits 1 and stores nothing.
Synopsis#
fireman load [--name WORKSPACE] [--source MODULE.FUNC]... [FILES]...
Option |
Meaning |
Default |
|---|---|---|
|
YAML ( |
|
|
Import the module |
|
|
Workspace to store into; replaces one with the same name |
|
Give at least one file or --source. The file format is in Input format.
Examples#
Save the sample estate as 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}
Then load it:
fireman load estate.yaml
Loaded workspace 'default': 1 firewalls, 2 policies, 10 rules, 10 objects.
The counts cover every scope: the 10 objects are the 9 global ones plus edge’s
own web-servers.
Keep a second copy under another name, for example to compare a change:
fireman load estate.yaml --name lab
Loaded workspace 'lab': 1 firewalls, 2 policies, 10 rules, 10 objects.
Several files are merged into one estate, so objects can live in one file and
firewalls in others: fireman load objects.yaml edge.yaml core.yaml.
A failing load#
Here is a copy of the estate, bad.yaml, with two typos: allow-admin-ssh uses
dmz-host instead of dmz-hosts, and allow-dns asks for a service ntp
that doesn’t exist.
fireman load bad.yaml
edge/inbound/inventory: rule 'allow-admin-ssh' destinations: unknown address name or invalid address 'dmz-host'
edge/outbound/inventory: rule 'allow-dns' services: unknown service name 'ntp'
The exit code is 1, and the default workspace still holds the last good load.
Names are only checked once every item is valid on its own. With a typo in a
field value, say action: drop in place of both denys, you get those first:
edge/inbound/rules[0].action: Input should be 'accept' or 'deny'
edge/inbound/rules[3].action: Input should be 'accept' or 'deny'
Each line starts with the scope, the section and the item’s index (from 0). Load errors lists the three stages and their messages.
Your own formats#
--source MODULE.FUNC loads anything you can read from Python: a CSV export, a
vendor’s XML, an API. It is a dotted path, like an import: MODULE is a module
and FUNC a function in it that returns a Source. The current folder is on the
import path, so sources.py here is sources; an installed package or one on
PYTHONPATH works too (mypkg.sources.dc). It mixes with FILES, and Fireman
watches the module’s file, and the data files its resources declare, for the
stale-source warning. Every --source is read before FILES, each group in the
order given, so a file’s items come after the sources’ (see
merge order). A crash in your function or file is reported
as Error: --source MODULE.FUNC: ValueError: message, exit 1. Extending shows how to write one.
fireman load objects.yaml --source sources.dc_rules
When it stores the workspace, Fireman hashes every file it watches: FILES, each
--source module and the data files its resources declare. If one can’t be read
then, say a declared file that doesn’t exist or is a folder, the load stops with
Error: cannot read recorded file '/path/to/hosts.csv': No such file or directory,
exit 1, and stores nothing. Later on, a watched file that can’t be read counts
as changed, so commands warn and carry on.
Common errors#
These exit 2 and store nothing.
Message |
Cause |
|---|---|
|
No input given |
|
A file path is wrong |
|
Not a dotted path |
|
The module is not importable |
|
A bad workspace name |