Giter Site home page Giter Site logo

mkzone's Introduction

mkzone

mkzone generates bind zone files from yaml files.

The easiest way to learn how to use it is to look at the example yaml files. There are three in total covering a domain "example.com" and both IPv4 and IPv6 reverse zone files.

Forward zones

These are fairly straight forward:

origin: example.com.
ttl: 1h

soa:
    ns: ns.example.com.
    user: root.example.com.

records:
    - type: NS
      value: ns.example.com.

    - type: MX
      priority: 10
      value: mx.example.com.

    - type: A
      host: ns
      value: 203.0.113.1

    - type: AAAA
      host: ns
      value: 2001:db8::1

    - type: A
      host: mx
      value: 203.0.113.2

    - type: AAAA
      host: mx
      value: 2001:db8::2

    - type: A
      host: '@'
      value: 203.0.113.3

    - type: AAAA
      host: '@'
      value: 2001:db8::3

    - type: CNAME
      host: www
      value: example.com.

This example shows all the current record types supported at the moment. Once catch is that @ symbols need to be quoted. Could possibly avoid this somehow.

Reverse zones

Reverse zones are indicated by type: reverse:

origin: 203.0.113.0/24
ttl: 1h
type: reverse

soa:
    ns: ns.example.com.
    user: root.example.com.

records:
    - type: NS
      value: ns.example.com.

    - type: PTR
      host: ns.example.com.
      value: 203.0.113.1

    - type: PTR
      host: mx.example.com.
      value: 203.0.113.2

    - type: PTR
      host: example.com.
      value: 203.0.113.3

Reverse zones are processed a little differently. The origin needs to be in CIDR format. That is include the netmask. mkzone uses this to calculate the correct origin and host entries. Run ./mkzone examples/reverse.ip4.yml and you will get the idea.

Requirements

mkzone is written in Python 3. It also uses the ipaddress module which is only included in Python 3.3.2+ and only on a provisional basis. If your distro doesn't package Python 3.3.2+ try pyenv or something similar.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.