Load bind9 zone files into a PAN-OS firewall as address and address group objects.
Creates {hostname}-fqdn, {hostname}-v4, {hostname}-v6 (and {hostname}-v4_{n} /
{hostname}-v6_{n} for hosts with multiple IPv4 and / or IPv6 addresses) address objects and a
{hostname} address group per host in the zone file.
Parses inline comments for a tag (panos_tag=) and descriptions (panos_desc=), these can appear
anywhere in the comments. Values with spaces are supported but must be quoted. Tags must already
exist on the PAN-OS device.
For example:
example IN A 10.10.10.10 ; some comment panos_tag=trust panos_Desc="box that does things"
NOTE: Updates to IPs, panos_tag, or panos_desc will be propagated to the PAN-OS device on
next run, however, renamed or deleted hosts will not be removed from PAN-OS, this must be done
manually.
- Python 3.10 to 3.14 on Linux, macOS, or Windows,
- PIP Module
dnspython, and - PIP Module
pan-os-python.
- Copy the project to the bind server, or another host with access to the zone files.
- Create a virtual environment:
python3 -m venv venv ; source venv/bin/activate. - Install the dependencies:
pip3 install -r ./requirements.txt. - Create a configuration file:
cp example.conf bind9_to_panos.conf. - Restrict access to the configuration file:
chmod 600 bind9_to_panos.conf. - Edit the
DEFAULTsection ofbind9_to_panos.confto point to your firewall. - Edit the
example.tldsection ofbind9_to_panos.confto point to the zone file. - (Optional) Add additional sections for other zone files.
- Run the script:
python3 bind9_to_panos.py. - (Optional) Add a cron job to run the script periodically:
- Disable printing to screen by setting
log_to_screentoFalseinbind9_to_panos.conf. - Open the crontab for the desired users:
sudo crontab -u <username> -e.- Use a low privilege user that can read the zone files, avoid
rootandnamed.
- Use a low privilege user that can read the zone files, avoid
- Add the cron job to the file on the desired schedule (04:00 daily in this example):
0 4 * * * /path/to/venv/bin/python3 /path/to/bind9_to_panos.py.
- Disable printing to screen by setting