How to Audit Cloudflare Zone Records Easily
Auditing, verifying and confirming DNS records is important for organisations of all sizes to ensure:
- Zones don’t become cluttered with unused records.
- Zones have not been manipulated or edited without the proper authorisation.
- Zones can be re-created easily should it become corrupted.
In order to help with this, I have written a simple Python3 script that makes use of Cloudflare’s APIs to automatically get all of the relevant zones and the records within those zones.
This script will:
- Find all of the zones within the account (irrespective of the number of organisations).
- Create a CSV for each zone.
- Send an aggregated email with the records within each zone.
This script needs:
- A Cloudflare token.
- Requests (pip install requests)
- An SMTP Account / Server