Skip to main content

zonefilegen

A simple tool to generate synchronized forward and reverse DNS zone files based on an input text file.

The intended use case is where a local authoritative DNS server is used to serve lookups for hosts confined within a single forward DNS zone. Thus, only a single forward zone is supported in order to simplify the input file.

Reverse zones will be generated for specified subnets, and they will be automatically populated with PTR records corresponding to the first A and AAAA records found in the input file for a certain host.

Zone serial numbers will automatically be incremented when the input file has changed.

Installation

Install via pip:

pip install zonefilegen

Usage

The package installs a command line tool zonefilegen which generates zone files in a specified directory based on an input file:

zonefilegen input.toml output_folder

This will parse input.toml and generate one forward zone file and zero and more reverse zone files in output_dir.

Input file format

The input file is written in the TOML format which is easy to read by both humans and machines.

For an example file, see docs/sample.toml.

Required entries

The following entries are required in the input file:

  • origin: The FQDN of the forward DNS zone. $ORIGIN in the zone file.

  • default_ttl: Default TTL for resource records if they have none set. $TTL in the zone file.

  • [soa]: Contains the entries to put in the SOA record, except for the serial number:

    • mname
    • rname
    • refresh
    • retry
    • expire
    • negative_caching_ttl
  • One or more [[rrset]] with entries for the forward records. Each [[rrset]] entry contains one or more records with the same name, type and ttl value:

    • name: @, unqualified name or FQDN.
    • type: The record type like A or MX.
    • ttl: Optional TTL value.
    • data: A string or a list of strings with the record data. A separate record will be created for every string in the list.

Optionally, one can also supply a networks entry, which should contain a list of networks in CIDR notation (ipv4 or ipv6) for which reverse zones should be created. The networks must end on whole-octet (ipv4) or whole-nibble edges (ipv6). So only /16, /24 etc in the ipv4 case and /48, /52, /56 etc for ipv6.

Metadata

Release files for zonefilegen 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zonefilegen 0.2.0
File Size Uploaded
zonefilegen-0.2.0.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zonefilegen 0.2.0
File Interpreter ABI Platform
zonefilegen-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / zonefilegen-0.2.0.tar.gz

Download URL zonefilegen-0.2.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f7a6ed4af3b551669ec65d05f20dec3da7db4da49bf012fbd2600fb24586db45
BLAKE2b-256 checksum
How to use checksums
f9c645e976beaa01b5d5ecc214bc9f546ac710727177a4d340ab73a6f084e100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / zonefilegen-0.2.0-py3-none-any.whl

Download URL zonefilegen-0.2.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c4c7fce52deb23f42dab1a2bcc31d0dd616e09216ff5efd8208aca7cb74e085
BLAKE2b-256 checksum
How to use checksums
3729230639b2dfc8c2170bc0ef9cb8fb4a3941a3d3353c094ec314e3df805dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page