Working on a new project can bring lots of surprises, especially if the setup has been running for years. In this specific case, I needed to quickly validate a large number of domains to check if their delegation is set correctly.
As it turned out, few domains had invalid delegation, some got expired and were no longer used, a single domain was publicly reserved but hosted internally with no Internet-facing delegation.
For the sake of simplicity, I decided to work on Infoblox CSV export format as script input, since the output was to be converted into excel anyway. The default Infoblox export CSV file has following columns:
- Name
- Grid Primary Servers
- Type
- Comment
- Multi-master Zone
- Monitored Since
- Last Queried
- Records Monitored
The last queried field might give an indication whether the domain was recently used, however, it does not provide the answer to the delegation configuration.
Script takes in 2 parameters: input filename and output filename. The output file contains the same set of columns, with addition of:
- SOA_NS – SOA nameserver
- SOA Admin – SOA Admin entry
- SOA Answer – full raw SOA answer section
- NS_List – List of nameservers from ns query
> python3 delegation.py zones.csv zones-out-list.csv