Skip to main content

A library and tool to generate sychronized forward and reverse DNS zone files.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zonefilegen-0.2.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

zonefilegen-0.2.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file zonefilegen-0.2.0.tar.gz.

File metadata

  • Download URL: zonefilegen-0.2.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for zonefilegen-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f7a6ed4af3b551669ec65d05f20dec3da7db4da49bf012fbd2600fb24586db45
MD5 9e8d6def259eb4ae0bd1d6b483709f76
BLAKE2b-256 f9c645e976beaa01b5d5ecc214bc9f546ac710727177a4d340ab73a6f084e100

See more details on using hashes here.

File details

Details for the file zonefilegen-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zonefilegen-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for zonefilegen-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c4c7fce52deb23f42dab1a2bcc31d0dd616e09216ff5efd8208aca7cb74e085
MD5 4655d3b192986bacb9b849eadb23a41a
BLAKE2b-256 3729230639b2dfc8c2170bc0ef9cb8fb4a3941a3d3353c094ec314e3df805dc3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page