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.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

zonefilegen-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zonefilegen-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for zonefilegen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 57eaf0a9bec8c5fd104682eb7b16ab7fc61b5a9a654e6d08e2eac6898e51c862
MD5 f2bfc5495fbf477ba104a2701205f181
BLAKE2b-256 a2b9198205522d9a9a0eb056440932313c6ed9ab5f4fe0264bd309cddb4985b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zonefilegen-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for zonefilegen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3af0954e80183b476a6c40a5d1496ab0942868386dbc52bd4562f99e673ef661
MD5 7d48483a3f4127e24a96ff548087999c
BLAKE2b-256 f561d715686e4c5e6283da23b1cf8c81c3a4606413d90dc11461fb766f48a5f7

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