{"id":14065082,"url":"https://github.com/oskar456/dzonegit","last_synced_at":"2025-10-15T07:02:00.155Z","repository":{"id":32742164,"uuid":"141398916","full_name":"oskar456/dzonegit","owner":"oskar456","description":"Git hooks to manage a repository of DNS zones","archived":false,"fork":false,"pushed_at":"2021-12-21T21:31:51.000Z","size":84,"stargazers_count":52,"open_issues_count":3,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-22T20:13:44.819Z","etag":null,"topics":["dns","dns-server","git"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oskar456.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-18T07:37:20.000Z","updated_at":"2025-03-22T10:59:06.000Z","dependencies_parsed_at":"2022-07-16T04:46:14.879Z","dependency_job_id":null,"html_url":"https://github.com/oskar456/dzonegit","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskar456%2Fdzonegit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskar456%2Fdzonegit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskar456%2Fdzonegit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oskar456%2Fdzonegit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oskar456","download_url":"https://codeload.github.com/oskar456/dzonegit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250316058,"owners_count":21410476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dns","dns-server","git"],"created_at":"2024-08-13T07:04:17.278Z","updated_at":"2025-10-15T07:02:00.063Z","avatar_url":"https://github.com/oskar456.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":".. image:: https://travis-ci.org/oskar456/dzonegit.svg?branch=master\n    :target: https://travis-ci.org/oskar456/dzonegit\n\nGit hooks to manage a repository of DNS zones\n=============================================\n\n``dzonegit`` is a set of Git hooks allowing you to manage DNS zone files in a\ngit repository. First, zone file sanity checks are run by ``pre-commit`` hook\non your computer. After pushing changes to a bare repository on the DNS server,\nthe sanity checks are run again on the server and if everything is OK,\nrepository is checked out to a directory, DNS software configuration\nsnippets are re-generated from a simple template and finally reload command\nis issued.\n\nMain features\n-------------\n\n- check if zone file compiles properly using `named-compilezone(8)`_\n- autodetect zone name from file name or ``$ORIGIN`` directive\n- enforce updating serial number when zone content is changed\n- optional ``smudge`` filter to replace ``$UNIXTIME`` directive with current UNIX time\n- both ``pre-commit`` and ``pre-receive``/``update`` hooks to enforce similar checks in the remote repository\n- ``post-receive`` hook to checkout the working copy from a bare repository, generate config snippets for various DNS server software and reload them\n- only Python 3.5+ standard library is used\n\n\nRequirements\n------------\n\n- Python 3.5+\n- `named-compilezone(8)`_ (part of `bind9utils` package)\n- git\n\n\nSimple instalation (especially for workstations)\n------------------------------------------------\n\nSince there is no other Python dependency than the standard library, you can\nsimply download the `dzonegit.py` file, make it executable and rename/symlink\nit to an appropriate hook location inside the Git repository\n`.git/hooks/pre-commit`. This is especially handy for the end users not\nexperienced with Python packaging ecosystem.\n\n\nFull instalation and usage\n--------------------------\n\n- install all the requirements\n- install ``dzonegit`` Python package using your\n  favourite tool (``virtualenvwrapper``, ``venv``, ``pipenv``, etc.)\n- in the local repository, create a symlink for the ``pre-commit`` hook:\n  ``$ ln -s $(which dzonegit-pre-commit) /path/to/repo/.git/hooks/pre-commit``\n- on the server, install some git repository management software,\n  preferably Gitolite_\n- on the server, install either ``pre-receive`` or ``update`` hook\n  (both do the same) as  well as the ``post-receive`` hook. See `Gitolite\n  documentation on how to add custom hooks`_\n- on the server, set up the configuration options for each repository\n\nSupport for $UNIXTIME directive\n-------------------------------\n\nIf you want to use ``$UNIXTIME`` in your zone files instead of serial number,\nyou have to install a `smudge` filter on the server, that will replace the\ndirective with current unix time on every checkout. First, set up the filter\nin the Git configuration:\n\n.. code-block:: shell\n\n        $ git config --global filter.dzonegit.smudge $(which dzonegit-smudge-serial)\n\n\nThen, apply the filter on all zone files using either ``.git/info/attributes``\nor directly ``.gitattributes`` file inside the repository:\n\n.. code-block::\n\n        *.zone filter=dzonegit\n\n\nConfiguration options\n---------------------\n\nAll configuration options are stored in `git-config(1)`_ in the section\nnamed ``dzonegit``.  All boolean options default to *False*.\n\n\n*dzonegit.ignorewhitespaceerrors*\n  Ignore white space errors in ``pre-commit`` and ``pre-receive``/``update`` hooks.\n\n*dzonegit.allowfancynames*\n  In  ``pre-commit`` and ``pre-receive``/``update`` hooks, do not enforce zone\n  file name to be similar to the name of the zone.\n\n*dzonegit.noserialupdate*\n  Do not try to automatically update zone serial number if necessary.\n  Valid only in the ``pre-commit`` hook.\n\n*dzonegit.nomissingdotcheck*\n  Do not check for forgotten final dot on the right-hand side of PTR records.\n  Valid only in the ``pre-commit`` hook.\n\n*dzonegit.checkoutpath*\n  Path to a writable directory, to which ``post-receive`` hook checks out\n  current *HEAD* after each update.\n\n*dzonegit.conffiletemplate*\n  Path to a JSON file containing template for generating DNS server\n  configuration snippet. See below for file format specification. More\n  files can be provided by appending single digit from 1 to 9 to this option.\n\n*dzonegit.conffilepath*\n  Path to a writable file to generate DNS server configuration snippet.\n  More files can be provided by appending single digit from 1 to 9 to this\n  option. Each file is generated using the template with corresponding suffix.\n\n*dzonegit.reconfigcmd*\n  A command to run when zones are introduced, deleted or renamed in the\n  repository. Should do something like ``rndc reconfig``. More commands\n  can be provided by appending single digit from 1 to 9 to this option.\n\n*dzonegit.zonereloadcmd*\n  A command to run for each zone, where zone file has been modified. Zone\n  name is automatically appended as the last argument. Should do something\n  like ``rndc reload``. More commands can be provided by appending single digit\n  from 1 to 9 to this option.\n\n*dzonegit.zoneblacklist*\n  Path to a text file containing list of zone names without trailing dots,\n  one per line. If zone is found on the blacklist, it is ignored when\n  ``post-receive`` hook generates configuration. Wildcards can be used as\n  well, see `JSON template`_ below.\n\n*dzonegit.zonewhitelist*\n  Path to a text file containing list of zone names without trailing dots,\n  one per line. If not empty and zone is not found on the whitelist,\n  it is ignored when ``post-receive`` hook generates configuration. Wildcards\n  can be used as well, see `JSON template`_ below.\n\nJSON template\n-------------\n\nThe DNS server configuration snippets are generated using a simple JSON-based\ntemplate. All keys are optional but please make sure the file is a valid JSON\nfile. It is possible to define a zone-specific options, for instance for\nchanging DNSSEC parameters per zone. Those zone-specific options allow usage of\nwildcards; if an exact match of zone name is not found, the leftmost label is\nsubstituted with `*`. If still no match is found, the leftmost label is dropped\nand the second one is again substituted with `*`. In the end, a single `*` is\nchecked. Only if even this key is not found, the value of *defaultvar* is used\nas the zone-specific option.\n\nValid keys are:\n\n*header*\n  A string that is templated to the begining of the output file.\n\n*footer*\n  A string that is templated to the end of the output file.\n\n*item*\n  A string that is templated for each zone.\n\n*defaultvar*\n  A string that would template variable ``$zonevar`` expand to if there is not\n  a zone-specific variable defined, nor any wildcard matched.\n\n*zonevars*\n  An object mapping zone names (without the final dot) to a zone-specific\n  variable to which template variable ``$zonevar`` would expand to. Using\n  wildcards is possible by replacing the leftmost label with `*`. Ultimately,\n  a key with label `*` will match every single zone (making *defaultvar*\n  option litte bit pointless)\n\nIn the template strings, these placeholders are supported:\n\n``$datetime``\n  Current date and time in human readable format\n\n``$zonename``\n  Zone name, without the trailing dot\n\n``$zonefile``\n  Full path to the zone file\n\n``$zonerelfile``\n  Path to the zone file, relative to checkout path (useful for chroot environments)\n\n``$zonevar``\n  Per-zone specific variable, see above\n\nExample JSON template for Knot DNS\n..................................\n\n.. code-block:: json\n\n    {\n      \"header\": \"# Managed by dzonegit, do not edit.\\nzone:\",\n      \"footer\": \"\",\n      \"item\": \" - domain: \\\"$zonename\\\"\\n   file: \\\"$zonefile\\\"\\n   $zonevar\\n\",\n      \"defaultvar\": \"template: default\",\n      \"zonevars\": {\n        \"example.com\": \"template: signed\",\n        \"*.cz\": \"template: czdomains\",\n        \"*.in-addr.arpa\": \"template: ipv4reverse\"\n      }\n    }\n\n\nExample JSON template for BIND\n..............................\n\n.. code-block:: json\n\n    {\n      \"header\": \"# Autogenerated by dzonegit on $datetime. Do not edit.\\n\",\n      \"item\": \"zone \\\"$zonename\\\" {\\n type master;\\n file \\\"$zonefile\\\";\\n};\"\n    }\n\n\n.. _named-compilezone(8): https://linux.die.net/man/8/named-compilezone\n.. _git-config(1): https://linux.die.net/man/1/git-config\n.. _Gitolite: http://gitolite.com/gitolite/index.html\n.. _Gitolite documentation on how to add custom hooks: http://gitolite.com/gitolite/cookbook/#hooks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskar456%2Fdzonegit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foskar456%2Fdzonegit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foskar456%2Fdzonegit/lists"}