fireman#
The package root re-exports the names most scripts need, so
from fireman import Pipeline works. Each one is documented where it is
defined; the table links there. Pipeline and the builders live in
fireman.pipeline and fireman.build, documented below.
fireman.pipeline#
Run sources through validation and compilation.
- class fireman.pipeline.Pipeline(name='default')#
Loads sources, checks them, and compiles the result.
- load(*sources)#
Load every source and validate the whole estate.
- Raises:
LoadError – With every problem found. Bad items are reported first; the cross-checks only run once every item is valid.
- run(*sources, bdd, implicit_deny=True)#
Load every source, validate the whole estate and compile it.
- classify(inventory, *, make_bdd, implicit_deny=True, store=None, reuse=True)#
Classify every policy, reusing stored findings of unchanged firewalls.
With a
store, firewalls that were compiled are cached;reuse=Falserecomputes every firewall and refreshes the cache. Each missed firewall gets a fresh manager frommake_bdd, collected after compiling, so peak memory is one firewall’s.
fireman.build#
Builders for writing service entries and traffic sets by hand, in scripts, tests and requests.
- fireman.build.tcp(lo, hi=None)#
TCP ports
lotohi, or justlowhenhiis left out.
- fireman.build.udp(lo, hi=None)#
UDP ports
lotohi, or justlowhenhiis left out.
- fireman.build.icmp(icmp_type=None, icmp_code=None)#
ICMP of one type and optional code, or all of ICMP when called with no type.
- fireman.build.ICMP_ANY#
Every ICMP type and code, for use with
traffic.
- fireman.build.TCP_ANY#
Every TCP port.
- fireman.build.UDP_ANY#
Every UDP port.
- fireman.build.traffic(bdd, sources, destinations, *services)#
Build a traffic set from address strings and service entries.
Bind
bddonce withfunctools.partial(traffic, bdd).- Parameters:
- Returns:
The traffic from any source to any destination on any of the services.
- Raises:
ValueError – If an address is not valid IPv4 or a network has host bits set.
- Return type: