UFW Parser is a tool that remotely or locally fetches and parses UFW firewall rules from Linux servers, presenting them in a clean, tabular, and exportable format.
It supports various output formats such as:
- Console table
- CSV
- Excel
- Ansible-compatible YAML (
host_varsstyle)
- Fetch UFW rules locally or via SSH (with
sudoprivileges) - Group and consolidate firewall rules per server
- Export rules to:
- CSV
- Excel
- Terminal table
- Ansible host_vars YAML format (for easy automation)
- Structured logs with file rotation
- Fully modular and extensible design
- CLI-driven usage with debug support
Clone the repository and install dependencies:
git clone https://github.com/qf3l3k/ufw_parser.git
cd ufw_parser
pip install -e .You need Python 3.7+.
ufw_parser -c ~/.config/ufw_parser/hosts.yml -o ansible_yaml -of ~/exports/| Option | Description |
|---|---|
-c, --config |
Path to hosts configuration file |
-o, --output |
Output format: screen, csv, excel, or ansible_yaml |
-of, --output_folder |
Destination folder for exports |
-l, --log |
Log files directory |
-d, --debug |
Enable debug logging |
Example hosts.yml:
servers:
server1:
hostname: 192.168.1.10
processing: local
rule_path: /etc/ufw
server2:
hostname: your.remote.server
processing: remote
ssh_user: your_ssh_user
rule_path: /etc/ufw
use_ssh_agent: trueIf you encounter any issues or have feature requests, please file them on the GitHub issues page.
If you like this tool you can support it's development and ...
MIT
Project by qf3l3k at ChainTools.
Internal tag: 010
