ferm is used to write and manage complex firewall rules.
The software defines a configuration language for IPtables, the Linux kernel’s package filter.
This language allows a structured capturing of the filter rules, which facilitates their creation and also increases their legibility.
You can find more information on the project page.